Bug #74274 [Com]: Handling DST transitions correctly

From: Date: Wed, 07 Nov 2018 21:14:55 +0000
Subject: Bug #74274 [Com]: Handling DST transitions correctly
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-217850@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=74274&edit=1

 ID:                 74274
 Comment by:         oliverpool at hotmail dot fr
 Reported by:        heiglandreas@php.net
 Summary:            Handling DST transitions correctly
 Status:             Open
 Type:               Bug
 Package:            Date/time related
 Operating System:   Irrelelvant
 PHP Version:        7.1.3
 Block user comment: N
 Private report:     N

 New Comment:

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


Previous Comments:
------------------------------------------------------------------------
[2018-11-06 03:08:13] Jeremy at jcarnus dot fr

Hi
Is there a way to know when this will be solved ? 
Thanks

------------------------------------------------------------------------
[2017-04-05 11:48:54] requinix@php.net

Related To: Bug #74374

------------------------------------------------------------------------
[2017-03-19 12:10:06] heiglandreas@php.net

Further related issues:

https://bugs.php.net/bug.php?id=62331
https://bugs.php.net/bug.php?id=63311
https://bugs.php.net/bug.php?id=63459
https://bugs.php.net/bug.php?id=65811
https://bugs.php.net/bug.php?id=66187
https://bugs.php.net/bug.php?id=67269
https://bugs.php.net/bug.php?id=68286
https://bugs.php.net/bug.php?id=69943
https://bugs.php.net/bug.php?id=72255
https://bugs.php.net/bug.php?id=72398
https://bugs.php.net/bug.php?id=72486


Somewhat related but not actual duplicates:
https://bugs.php.net/bug.php?id=73255

------------------------------------------------------------------------
[2017-03-19 10:09:47] 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




------------------------------------------------------------------------



--
Edit this bug report at https://bugs.php.net/bug.php?id=74274&edit=1


Thread (6 messages)

« previous php.bugs (#217850) next »