1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 16:22:37 +01:00
Files
archived-php-src/ext/date/tests/bug75167.phpt
2021-04-06 20:50:32 +01:00

21 lines
613 B
PHP

--TEST--
Bug #75167 (DateTime::add does only care about backward DST transition, not forward)
--FILE--
<?php
$tz = new DateTimeZone('Europe/London'); // A timezone that has DST
$five_hours_interval = new DateInterval('PT5H');
$date = new DateTime("2014-3-30 00:00:00", $tz);
// Add five hours and subtract 5 hours. The $newDate should then equal the date.
$five_hours_later = (clone $date)->add($five_hours_interval);
$newDate = (clone $five_hours_later)->sub($five_hours_interval);
echo $date->format('c') . "\n";
echo $newDate->format('c');
?>
--EXPECT--
2014-03-30T00:00:00+00:00
2014-03-30T00:00:00+00:00