Skip to content

Commit cc9c577

Browse files
committedJul 21, 2022
Fixed GH-8730: DateTime::diff miscalculation is same time zone of different type
1 parent eea2283 commit cc9c577

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed
 

‎ext/date/tests/gh8730.phpt

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
--TEST--
2+
Bug GH-8730 (DateTime::diff miscalculation is same time zone of different type)
3+
--FILE--
4+
<?php
5+
$foo = new DateTime('2022-06-08 09:15:00', new DateTimeZone('-04:00'));
6+
$bar = new DateTime('2022-06-08 09:15:00', new DateTimeZone('US/Eastern'));
7+
print_r($foo->diff($bar));
8+
?>
9+
--EXPECT--
10+
DateInterval Object
11+
(
12+
[y] => 0
13+
[m] => 0
14+
[d] => 0
15+
[h] => 0
16+
[i] => 0
17+
[s] => 0
18+
[f] => 0
19+
[weekday] => 0
20+
[weekday_behavior] => 0
21+
[first_last_day_of] => 0
22+
[invert] => 0
23+
[days] => 0
24+
[special_type] => 0
25+
[special_amount] => 0
26+
[have_weekday_relative] => 0
27+
[have_special_relative] => 0
28+
)

0 commit comments

Comments
 (0)