Bug #80974 [NEW]: Wrong diff between 2 dates in different timezones

From: Date: Wed, 21 Apr 2021 22:00:41 +0000
Subject: Bug #80974 [NEW]: Wrong diff between 2 dates in different timezones
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-233547@lists.php.net to get a copy of this message
From:             kylekatarnls at gmail dot com
Operating system: Ubuntu
PHP version:      master-Git-2021-04-21 (Git)
Package:          Date/time related
Bug Type:         Bug
Bug description:Wrong diff between 2 dates in different timezones

Description:
------------
In PHP < 8.1, comparing 2 date-times from different timezones would
consider the real moment they represent to return the diff, which is
completly relevant. But it's no longer true (sounds like introduced by
091c0920b9db057a54dc43ece6e864bce6818d5e).

Test script:
---------------
$dtToronto = new DateTime('2012-01-01 00:00:00.000000
America/Toronto');
$dtVancouver = new DateTime('2012-01-01 00:00:00.000000
America/Vancouver');

echo $dtVancouver->diff($dtToronto)->format('%h');

Expected result:
----------------
3

Actual result:
--------------
0

-- 
Edit bug report at https://bugs.php.net/bug.php?id=80974&edit=1
-- 
Fix committed:                    https://bugs.php.net/fix.php?id=80974&r=fixed
Fixed in release:                 https://bugs.php.net/fix.php?id=80974&r=alreadyfixed
Need backtrace:                   https://bugs.php.net/fix.php?id=80974&r=needtrace
Need Reproduce Script:            https://bugs.php.net/fix.php?id=80974&r=needscript
Try newer version:                https://bugs.php.net/fix.php?id=80974&r=oldversion
Not developer issue:              https://bugs.php.net/fix.php?id=80974&r=support
Expected behavior:                https://bugs.php.net/fix.php?id=80974&r=notwrong
Not enough info:                  https://bugs.php.net/fix.php?id=80974&r=notenoughinfo
Submitted twice:                  https://bugs.php.net/fix.php?id=80974&r=submittedtwice
register_globals:                 https://bugs.php.net/fix.php?id=80974&r=globals
PHP version support discontinued: https://bugs.php.net/fix.php?id=80974&r=phptooold
Daylight Savings:                 https://bugs.php.net/fix.php?id=80974&r=dst
IIS Stability:                    https://bugs.php.net/fix.php?id=80974&r=isapi
Install GNU Sed:                  https://bugs.php.net/fix.php?id=80974&r=gnused
Floating point limitations:       https://bugs.php.net/fix.php?id=80974&r=float
No Zend Extensions:               https://bugs.php.net/fix.php?id=80974&r=nozend
MySQL Configuration Error:        https://bugs.php.net/fix.php?id=80974&r=mysqlcfg


Thread (8 messages)

« previous php.bugs (#233547) next »