xref: /PHP-8.3/ext/date/tests/bug71826.phpt (revision 091c0920)
1--TEST--
2Bug #71826 (DateTime::diff confuse on timezone 'Asia/Tokyo')
3--FILE--
4<?php
5// Asia/Tokyo ...something wrong
6date_default_timezone_set('Asia/Tokyo');
7
8$a = (new DateTime('2015-2-1'))->diff(new DateTime('2015-3-1'));
9echo "a(Asia/Tokyo): 2015-2-1 <--> 2015-3-1\n";
10var_dump($a->m, $a->d);
11
12$b = (new DateTime('2015-3-1'))->diff(new DateTime('2015-3-29'));
13echo "\nb(Asia/Tokyo): 2015-3-1 <--> 2015-3-29\n";
14var_dump($b->m, $b->d);
15
16$c = (new DateTime('2015-4-1'))->diff(new DateTime('2015-4-29'));
17echo "\nc(Asia/Tokyo): 2015-4-1 <--> 2015-4-29\n";
18var_dump($c->m, $c->d);
19?>
20--EXPECT--
21a(Asia/Tokyo): 2015-2-1 <--> 2015-3-1
22int(1)
23int(0)
24
25b(Asia/Tokyo): 2015-3-1 <--> 2015-3-29
26int(0)
27int(28)
28
29c(Asia/Tokyo): 2015-4-1 <--> 2015-4-29
30int(0)
31int(28)
32
33