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

Description

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. http://www.timeanddate.com/time/dst/1972a.html I think this is where the change is happening.

Comments

No comments to display