Implement date_format validation rule.

This commit is contained in:
Franz Liedke
2012-09-07 14:02:04 +02:00
parent 49331d74e2
commit a40aabbb05
2 changed files with 14 additions and 0 deletions

View File

@@ -758,6 +758,19 @@ class Validator {
return (strtotime($value) > strtotime($parameters[0]));
}
/**
* Validate the date conforms to a given format.
*
* @param string $attribute
* @param mixed $value
* @param array $parameters
* @return bool
*/
protected function validate_date_format($attribute, $value, $parameters)
{
return date_create_from_format($parameters[0], $value) !== false;
}
/**
* Get the proper error message for an attribute and rule.
*