Issue Type: Bug Created: 2008-05-28T03:27:59.000+0000 Last Updated: 2008-09-02T10:39:27.000+0000 Status: Resolved Fix version(s): - 1.6.0 (02/Sep/08)
Reporter: Steven Reed (stevereed) Assignee: Thomas Weidner (thomas) Tags: - Zend_Validate
Related issues: Attachments:
When you specify a custom date format to Zend_Validate_Date and subsequently call isValid(), if your date is of the correct format but an invalid date, the validator returns a message saying the date was in the incorrect format.
This is caused by using Zend_Date::isDate() and assuming a return value of false means the date is in the incorrect format when it could be in the correct format but not a valid date (e.g., 30 Feb of any year).
<pre class="highlight"> $validator = new Zend_Validate_Date('MM/DD/YYYY'); // Correctly returns true $validator->isValid('02/29/2008'); // Returns false (correctly) with message "'02/30/2008' does not fit given date format" (incorrect) $validator->isValid('02/30/2008');
Posted by Thomas Weidner (thomas) on 2008-05-29T13:12:49.000+0000
But the message is right... A 30. February does NOT fit the given format.
What would you expect to get returned when you set 'DDD yyyy' and input "0 0" ? The returned message did not say that the given format is not correct, it returned that the input does not fit in the given format, which is correct.
Posted by Steven Reed (stevereed) on 2008-05-30T08:53:47.000+0000
My point is that the message "'02/30/2008' does not fit given date format" is misleading as a user may look at the message and be confident he inputed the date in the correct format, what he might not immediately realise is that 30 Feb is an invalid date; therefore, a message saying "'02/30/2008' is not a valid date" would give better feedback on the user's error that what is currently being returned.
Currently, I will get the same error message whether I inputed an invalid date in the correct format or inputted a 'date' in the incorrect format.
Posted by Thomas Weidner (thomas) on 2008-06-05T05:19:47.000+0000
Changed returned message with r9613
Posted by Wil Sinclair (wil) on 2008-09-02T10:39:27.000+0000
Updating for the 1.6.0 release.
Have you found an issue?
See the Overview section for more details.