ZF-5277: fix_dst doesn`t work correctly
Description
In the following example, the fix_dst option doesn`t work correctly.
ini_set('date.timezone', 'UTC');
Zend_Date::setOptions(array('fix_dst' => true));
$date = new Zend_Date(mktime(22, 0, 0, 10, 25, 2008));
$date->setTimezone('Europe/Berlin');
$date->add(1, Zend_Date::DAY);
$date->sub(1, Zend_Date::SECOND);
echo $date->get(Zend_Date::DATE_SHORT) . ' ' . $date->get(Zend_Date::TIME_MEDIUM);
Current result: 26.10.08 22:59:59
Expected result: 26.10.08 23:59:59
This bugreport relates to a post in the german ZF-Forum. http://www.zfforum.de/showthread.php?t=2853
When I set the default timezone to Europe\Berlin and not to UTC it works, but this is not the required approach.
Comments
Posted by Thomas Weidner (thomas) on 2008-12-16T01:09:25.000+0000
Debugging your example I get:
The date object contains
which is correct... now you set the timezone
and the object changes to
which is correct because we are in summertime on this date so GMT+2 Now you add one day
but there is a change from summer to wintertime... so the object changes to
because this day has only 23 hours, but also the zone changes to GMT+1 Substracting one second makes no difference
as the zone does not change on 22-23h.
I see no problem at all.