xref: /PHP-8.3/ext/date/tests/bug77571.phpt (revision c8a6a8ab)
1--TEST--
2Bug #77571 (DateTime's diff DateInterval incorrect in timezones from UTC+01:00 to UTC+12:00)
3--FILE--
4<?php
5
6date_default_timezone_set('Europe/London');
7
8$date3 = DateTime::createFromFormat('Y-m-d H:i:s', '2019-04-01 00:00:00'); //  2019-04-01 00:00:00.0 Europe/London (+01:00)
9$date4 = clone $date3;
10$date4->modify('+5 week'); // 2019-05-06 00:00:00.0 Europe/London (+01:00)
11$differenceDateInterval2 = $date3->diff($date4); // interval: + 1m 4d; days 35
12print_r($differenceDateInterval2);
13?>
14--EXPECT--
15DateInterval Object
16(
17    [y] => 0
18    [m] => 1
19    [d] => 5
20    [h] => 0
21    [i] => 0
22    [s] => 0
23    [f] => 0
24    [invert] => 0
25    [days] => 35
26    [from_string] =>
27)
28