Bug #71826 [Opn->Csd]: DateTime::diff confuse on timezone 'Asia/Tokyo'

From: Date: Tue, 06 Apr 2021 19:53:44 +0000
Subject: Bug #71826 [Opn->Csd]: DateTime::diff confuse on timezone 'Asia/Tokyo'
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-233255@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=71826&edit=1 ID: 71826 Updated by: derick@php.net Reported by: sukobuto at gmail dot com Summary: DateTime::diff confuse on timezone 'Asia/Tokyo' -Status: Open +Status: Closed Type: Bug Package: Date/time related Operating System: CentOS 6.7 PHP Version: 5.6.19 -Assigned To: +Assigned To: derick Block user comment: N Private report: N New Comment: 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. Previous Comments: ------------------------------------------------------------------------ [2016-03-15 10:25:25] sukobuto at gmail dot com Description: ------------ In some conditions, DateTime::diff makes a mistake on month-section. For example, the gap of Feb 1 and Mar 1 is 1 month. But output was "0 month 28 days" in timezone Asia/Tokyo. ("1 month 0 days" in timezone UTC) Test script: --------------- https://wandbox.fetus.jp/permlink/zgdq2iE1VuL9zM50 Expected result: ---------------- a: 2015-2-1 <--> 2015-3-1 DateInterval Object ( [y] => 0 [m] => 1 [d] => 0 [h] => 0 [i] => 0 [s] => 0 [weekday] => 0 [weekday_behavior] => 0 [first_last_day_of] => 0 [invert] => 0 [days] => 28 [special_type] => 0 [special_amount] => 0 [have_weekday_relative] => 0 [have_special_relative] => 0 ) b: 2015-3-1 <--> 2015-3-29 DateInterval Object ( [y] => 0 [m] => 0 [d] => 28 [h] => 0 [i] => 0 [s] => 0 [weekday] => 0 [weekday_behavior] => 0 [first_last_day_of] => 0 [invert] => 0 [days] => 28 [special_type] => 0 [special_amount] => 0 [have_weekday_relative] => 0 [have_special_relative] => 0 ) c: 2015-4-1 <--> 2015-4-29 DateInterval Object ( [y] => 0 [m] => 0 [d] => 28 [h] => 0 [i] => 0 [s] => 0 [weekday] => 0 [weekday_behavior] => 0 [first_last_day_of] => 0 [invert] => 0 [days] => 28 [special_type] => 0 [special_amount] => 0 [have_weekday_relative] => 0 [have_special_relative] => 0 ) Actual result: -------------- a(Asia/Tokyo): 2015-2-1 <--> 2015-3-1 DateInterval Object ( [y] => 0 [m] => 0 [d] => 28 [h] => 0 [i] => 0 [s] => 0 [weekday] => 0 [weekday_behavior] => 0 [first_last_day_of] => 0 [invert] => 0 [days] => 28 [special_type] => 0 [special_amount] => 0 [have_weekday_relative] => 0 [have_special_relative] => 0 ) b(Asia/Tokyo): 2015-3-1 <--> 2015-3-29 DateInterval Object ( [y] => 0 [m] => 1 [d] => 0 [h] => 0 [i] => 0 [s] => 0 [weekday] => 0 [weekday_behavior] => 0 [first_last_day_of] => 0 [invert] => 0 [days] => 28 [special_type] => 0 [special_amount] => 0 [have_weekday_relative] => 0 [have_special_relative] => 0 ) c(Asia/Tokyo): 2015-4-1 <--> 2015-4-29 DateInterval Object ( [y] => 0 [m] => 0 [d] => 28 [h] => 0 [i] => 0 [s] => 0 [weekday] => 0 [weekday_behavior] => 0 [first_last_day_of] => 0 [invert] => 0 [days] => 28 [special_type] => 0 [special_amount] => 0 [have_weekday_relative] => 0 [have_special_relative] => 0 ) ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=71826&edit=1

« previous php.bugs (#233255) next »