Bug #74274 [Com]: Handling DST transitions correctly
Edit report at https://bugs.php.net/bug.php?id=74274&edit=1
ID: 74274
Comment by: kylethielk at gmail dot com
Reported by: heiglandreas@php.net
Summary: Handling DST transitions correctly
Status: Closed
Type: Bug
Package: Date/time related
Operating System: Irrelelvant
PHP Version: 7.1.3
Assigned To: derick
Block user comment: N
Private report: N
New Comment:
Derick is there a plan to add support for this to other active version of PHP rather than just 8.x?
PHP 7.4 is still in active development, it would be great to get this fix merged into 7.4 as well.
Previous Comments:
------------------------------------------------------------------------
[2021-04-06 19:54:26] derick@php.net
The fix for this bug has been committed.
If you are still experiencing this bug, try to check out latest source from https://github.com/php/php-src and re-test.
Thank you for the report, and for helping us make PHP better.
Fixed for PHP 8.1.
------------------------------------------------------------------------
[2018-11-07 21:14:55] oliverpool at hotmail dot fr
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
------------------------------------------------------------------------
[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
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
https://bugs.php.net/bug.php?id=74274
--
Edit this bug report at https://bugs.php.net/bug.php?id=74274&edit=1
Thread (6 messages)