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


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


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.

Isn't HH supposed to mean exactly 2 digits?

"HH Hour, (00-23), two digit Zend_Date::HOUR 02" (http://framework.zend.com/manual/en/…)

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.

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.

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.