Bug #81273 [Com]: Date interval calculation not correct
Edit report at https://bugs.php.net/bug.php?id=81273&edit=1
ID: 81273
Comment by: mail at gh01 dot de
Reported by: alex dot a dot pott at gmail dot com
Summary: Date interval calculation not correct
Status: Assigned
Type: Bug
Package: Date/time related
Operating System: OS X
PHP Version: 8.1Git-2021-07-19 (Git)
Assigned To: derick
Block user comment: N
Private report: N
New Comment:
This one also: https://bugs.php.net/bug.php?id=81263
Previous Comments:
------------------------------------------------------------------------
[2021-08-03 12:42:21] ramsey@php.net
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
------------------------------------------------------------------------
[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
Thread (6 messages)