Bug #81273 [Opn]: Date interval calculation not correct

From: Date: Tue, 03 Aug 2021 12:42:21 +0000
Subject: Bug #81273 [Opn]: Date interval calculation not correct
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-235556@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=81273&edit=1 ID: 81273 Updated by: ramsey@php.net Reported by: alex dot a dot pott at gmail dot com Summary: Date interval calculation not correct Status: Open Type: Bug Package: Date/time related Operating System: OS X PHP Version: 8.1Git-2021-07-19 (Git) -Assigned To: +Assigned To: derick Block user comment: N Private report: N New Comment: All of these seem related: - https://bugs.php.net/bug.php?id=80963 - https://bugs.php.net/bug.php?id=81287 - https://bugs.php.net/bug.php?id=80998 Previous Comments: ------------------------------------------------------------------------ [2021-07-23 10:57:50] antonino dot spampinato86 at gmail dot com Although not related to your problem but to +1 month of php 8.1 (must take the above behavior or change the datetime arithmetic page). https://3v4l.org/k2gS6 ------------------------------------------------------------------------ [2021-07-19 07:23:56] alex dot a dot pott at gmail dot com Description: ------------ Date interval calculation is has changed in 8.1 and the new calculation is incorrect. 8.0: https://3v4l.org/8g4NB#v8.0.8 8.1: https://3v4l.org/8g4NB/rfc#vgit.master This seems similar to https://bugs.php.net/bug.php?id=80998 Test script: --------------- <?php $time = '2000-01-01 00:00:00.000000'; $tz_aus = new DateTimeZone('Australia/Sydney'); $tz_us = new DateTimeZone('America/Los_Angeles'); $auz = new DateTime($time, $tz_aus); $us = new DateTime($time, $tz_us); $diff = $auz->diff($us); // Should output int(19) var_dump($diff->h); Expected result: ---------------- It should output: int(19) Actual result: -------------- int(0) ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=81273&edit=1

« previous php.bugs (#235556) next »