It appears that Zend_Validate_Date
just simply doesn't work properly. For example:
$validator = new Zend_Validate_Date(array('format' => 'yyyy'));
This is a simple validator that should only accept a four digit year, yet $validator->isValid('1/2/3')
returns true! Really, Zend?
Or how about this:
$otherValidator = new Zend_Validate_Date(array('format' => 'mm/dd/yyyy'));
Even with the above code, $otherValidator->isValid('15/13/10/12/1222')
returns true
too!
I'm using Zend Framework 1.11.9. Is it just me or is this a really terrible validation class? (UPDATE: In other words, is there something wrong with my code, or is this a bug that should be submitted?)
As the comments above say, apparently there's a bug with this class. Here is the workaround I came up with, using
Zend_Validate_Regex
:Hopefully that will help someone else. Please note that I only want slashes as separator, not dots or dashes.