xref: /php-src/ext/date/tests/bug80610.phpt (revision 091c0920)
1--TEST--
2Bug #80610 (DateTime calculate wrong with DateInterval)
3--FILE--
4<?php
5$expectEaster = date_create_from_format('Y-m-d H:i:s', '2020-04-12 12:00:00', new DateTimeZone('Europe/Berlin'));
6$interval = new DateInterval('PT20800M');
7$expectEaster->sub($interval);
8$expectEaster->add($interval);
9echo('easter '.$expectEaster->format('Y-m-d H:i:s')."\n" );
10
11$expectEaster = date_create_from_format('Y-m-d H:i:s', '2020-04-12 12:00:00', new DateTimeZone('Europe/Berlin'));
12$interval = new DateInterval('PT20715M');
13$expectEaster->sub($interval);
14$expectEaster->add($interval);
15echo('easter '.$expectEaster->format('Y-m-d H:i:s')."\n");
16
17$expectEaster = date_create_from_format('Y-m-d H:i:s', '2020-04-12 12:00:00', new DateTimeZone('Europe/Berlin'));
18$interval = new DateInterval('PT20700M');
19$expectEaster->sub($interval);
20$expectEaster->add($interval);
21echo('easter '.$expectEaster->format('Y-m-d H:i:s')."\n");
22?>
23--EXPECT--
24easter 2020-04-12 12:00:00
25easter 2020-04-12 12:00:00
26easter 2020-04-12 12:00:00
27