fixed fatal error when date value is invalid and no format is provided