|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2017-03-19 10:09 UTC] heiglandreas@php.net
Description: ------------ A lot of issues have been tracked regarding DST-Transitions. There also has been an RFC in 2011 (https://wiki.php.net/rfc/datetime_and_daylight_saving_time) which seems to be not implemented yet. This is supposed to be a collection of all the issues that have been raised up to now that all revolve around the same thing: DateTime doesn't handle the transition from Daylight Saving Time back to Standard Time correctly. https://bugs.php.net/bug.php?id=51051 https://bugs.php.net/bug.php?id=61530 https://bugs.php.net/bug.php?id=62185 This is closely related to an often claimed feature request to evaluate the Timezone-Parameter when a Timezone-identifier is given in the datetime-string. That would allow DateTime to realize whether the given time is DaylightSavingTime or Standard-Time and be a much less error prone way than using 'DT' and 'ST' as described in the RFC. Related to this are: https://bugs.php.net/bug.php?id=61022 PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Tue Oct 28 07:00:01 2025 UTC |
I found a simple test case where the DateInterval returned from `diff` looks quite strange (a complete day is missing): $tz = new DateTimeZone("Europe/Paris"); $startDate = new \DateTime('2018-10-28 00:00:00', $tz); $endDateBuggy = new \DateTime('2018-10-29 23:00:00', $tz); $endDateCorrect = new \DateTime('2018-10-29 22:59:59', $tz); // Buggy output print_r($startDate->diff($endDateBuggy)); /* DateInterval Object ( [y] => 0 [m] => 0 [d] => 2 [h] => -1 [i] => 0 [s] => 0 [f] => 0 [weekday] => 0 [weekday_behavior] => 0 [first_last_day_of] => 0 [invert] => 0 [days] => 1 ///////////////////// This is lower than [d]! This should be 2 [special_type] => 0 [special_amount] => 0 [have_weekday_relative] => 0 [have_special_relative] => 0 ) */ // Correct Output print_r($startDate->diff($endDateCorrect)); /* DateInterval Object ( [y] => 0 [m] => 0 [d] => 1 [h] => 22 [i] => 59 [s] => 59 [f] => 0 [weekday] => 0 [weekday_behavior] => 0 [first_last_day_of] => 0 [invert] => 0 [days] => 1 [special_type] => 0 [special_amount] => 0 [have_weekday_relative] => 0 [have_special_relative] => 0 ) */ This impacts Carbon: https://github.com/briannesbitt/Carbon/issues/1496