ZF-12182: Zend_Date::isDate() will return false given a valid date - daylight mismatch 1972

Issue Type: Bug Created: 2012-04-30T22:44:56.000+0000 Last Updated: 2012-04-30T22:44:56.000+0000 Status: Open Fix version(s): Reporter: Steven Scott (steven_scott) Assignee: Thomas Weidner (thomas) Tags: - Zend_Date

  • zend_date

Related issues: Attachments:


Zend_Date::isDate appears to return false when a valid date is presented.

$dateString = '2012-04-30T02:08:07-05:00'; var_dump(Zend_Date::isDate($dateString,Zend_Date::ISO_8601));

This will dump bool(false)

If the date is altered slightly by moving hour to 01 or 03 the function will return true.

After doing some digging into the code I noticed that the year was being converted to 1972 or 1971 based on whether this was a leap year.

    if (self::isYearLeapYear($parsed['year'])) {
        $parsed['year'] = 1972;
    } else {
        $parsed['year'] = 1971;

This new date was then fed into the mktime function to return the timestamp.

The returned date 1972-04-30T03:08:07-07:00 is shifted for the DST advance. It fails when it tries to compare the hour fields

After looking specifically at the date (April 30 1972) I found this resource that mentioned DST was set at 2AM on 4/30/1972. I think this is where the change is happening.


No comments to display

Have you found an issue?

See the Overview section for more details.


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

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