I'm validating a user-entered date string in YYYY-MM-DD
format using Zend_Validate::is($value,'Date')
.
This call creates this hierarchy:
Zend_Validate::is()
Zend_Validate_Date->isValid()
Zend_Date::isDate()
Zend_Locale_Format::getDate()
Zend_Locale_Format::_parseDate()
Finally, it fails with this exception:
Zend_Locale_Exception: Unable to parse date '2009-09-08' using 'MMM d, y' (M <> y) in /usr/share/php/Zend/Locale/Format.php on line 1001
I'm using en_US as my application locale. How can I configure Zend_Validate to accept this date format? Is it possible to change the locale format of the date, for example?
Try that:
$validator = new Zend_Validate_Date('YYYY-MM-DD');
if($validator->isValid($value))
// yay