xref: /PHP-8.2/ext/date/tests/bug80913.phpt (revision 091c0920)
1--TEST--
2Bug #80913 (DateTime(Immutable)::sub around DST yield incorrect time)
3--FILE--
4<?php
5$date = new DateTime('2021-03-28 03:00:00', new DateTimeZone('Europe/Amsterdam'));
6$_30mbefore = (clone $date)->sub(new DateInterval('PT30M'));
7$_30mafter = (clone $date)->add(new DateInterval('PT30M'));
8
9var_dump($date->format(DATE_ATOM));
10var_dump($_30mbefore->format(DATE_ATOM));
11var_dump($_30mafter->format(DATE_ATOM));
12?>
13--EXPECT--
14string(25) "2021-03-28T03:00:00+02:00"
15string(25) "2021-03-28T01:30:00+01:00"
16string(25) "2021-03-28T03:30:00+02:00"
17