xref: /PHP-8.4/ext/date/tests/bug81263.phpt (revision 818b46ac)
1--TEST--
2Bug #81263 (Wrong result from DateTimeImmutable::diff)
3--FILE--
4<?php
5
6$dt1 = new DateTimeImmutable('2020-07-19 18:30:00', new DateTimeZone('Europe/Berlin'));
7$dt2 = new DateTimeImmutable('2020-07-19 16:30:00', new DateTimeZone('UTC'));
8
9print_r($dt2->diff($dt1));
10print_r($dt1->diff($dt2));
11?>
12--EXPECTF--
13DateInterval Object
14(
15    [y] => 0
16    [m] => 0
17    [d] => 0
18    [h] => 0
19    [i] => 0
20    [s] => 0
21    [f] => 0
22    [invert] => 0
23    [days] => 0
24    [from_string] =>
25)
26DateInterval Object
27(
28    [y] => 0
29    [m] => 0
30    [d] => 0
31    [h] => 0
32    [i] => 0
33    [s] => 0
34    [f] => 0
35    [invert] => 0
36    [days] => 0
37    [from_string] =>
38)
39