xref: /PHP-8.0/ext/date/tests/bug80409.phpt (revision 4aeff60f)
1--TEST--
2Bug #80409: DateTime::modify() loses time with 'weekday' parameter
3--INI--
4date.timezone=UTC
5--FILE--
6<?php
7$date = '2020-11-27 12:33:00';
8
9echo date('Y-m-d H:i:s', strtotime($date.' +1 day')), "\n";
10echo date('Y-m-d H:i:s', strtotime($date.' +1 Weekday')), "\n";
11
12$date1 = new DateTime($date);
13$date2 = new DateTime($date);
14
15$date2->modify('+1 day');
16echo $date2->format('Y-m-d H:i:s'), "\n";
17
18$date1->modify('+1 weekday');
19echo $date1->format('Y-m-d H:i:s'), "\n";
20?>
21--EXPECT--
222020-11-28 12:33:00
232020-11-30 12:33:00
242020-11-28 12:33:00
252020-11-30 12:33:00
26