xref: /PHP-8.1/ext/date/tests/bug65003.phpt (revision 091c0920)
1--TEST--
2Bug #65003 (Wrong date diff)
3--FILE--
4<?php
5date_default_timezone_set("Europe/Moscow");
6
7$datetime1 = new DateTime('13-03-01');
8$datetime2 = new DateTime('13-04-01');
9
10$datetime3 = new DateTime('13-03-02');
11$datetime4 = new DateTime('13-04-02');
12
13$interval = $datetime2->diff($datetime1);
14echo $interval->format('%m month, %d days'), "\n"; //1 month, 3 days
15
16$interval = $datetime4->diff($datetime3);
17echo $interval->format('%m month, %d days'), "\n"; //1 month, 0 days
18?>
19--EXPECT--
201 month, 0 days
211 month, 0 days
22