ZF-5901: Zend_Date::isDate doesn't accept the format 'dd.MM.YY/HHmm'

Issue Type: Bug Created: 2009-02-27T00:18:41.000+0000 Last Updated: 2012-11-20T20:52:50.000+0000 Status: Closed Fix version(s): Reporter: Ivan Krechetov (ikr) Assignee: None Tags: - Zend_Date

Related issues: - ZF-6987



The code:

print(Zend_Date::isDate('20.10.09/1945', 'dd.MM.YY/HHmm') ? 'valid' : 'invalid'); print("\n");

print(Zend_Date::isDate('20.10.09/19:45', 'dd.MM.YY/HH:mm') ? 'valid' : 'invalid'); print("\n");

is expected to print:

valid valid

However, I get:

invalid valid


Posted by Thomas Weidner (thomas) on 2009-02-27T13:31:02.000+0000

Such date format are not accepted. Zend_Date can not detect if you meant 19 hours or 1945 hours.

Dates must always have a sort of seperator between their parts.

Posted by Ivan Krechetov (ikr) on 2009-02-27T22:48:12.000+0000

Isn't HH supposed to mean exactly 2 digits?

"HH Hour, (00-23), two digit Zend_Date::HOUR 02" (…)

Actually, I have that trouble with Zend_Validate_Date attached to a form element, which relies on Zend_Date::isDate(). I agree that's a weird format, but that's what airline agents are used to. They need to enter dates only with the numpad. And they don't put a dot between hours and minutes.

I can write a custom validator, of course. But I still believe it's a bug or wrong/incomplete documentation.

Posted by Thomas Weidner (thomas) on 2009-02-28T01:07:24.000+0000

No, HH means that you haven MINIMUM 2 digits.

This means the hour 1 will be displayed as 01. But the hour 130, think of a difference date calculation, is displayed as 130.

So handle this in your case you can eighter work with form fields... enter hour and minute in different elements and concat them with a seperator.

Or by creating a custom validator.

I agree that this is not really wished behaviour, but according to ISO this is how the standard is defined.

Posted by Rob Allen (rob) on 2012-11-20T20:52:50.000+0000

Bulk change of all issues last updated before 1st January 2010 as "Won't Fix".

Feel free to re-open and provide a patch if you want to fix this issue.

Have you found an issue?

See the Overview section for more details.


© 2006-2016 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.