xref: /PHP-8.0/ext/date/tests/bug63740.phpt (revision f8d79582)
1--TEST--
2Bug #63740 (strtotime seems to use both sunday and monday as start of week)
3--FILE--
4<?php
5$dates = [
6    '2015-07-04',
7    '2015-07-05',
8    '2015-07-06',
9    '2015-07-07',
10    '2015-07-08',
11    '2015-07-09',
12    '2015-07-10',
13    '2015-07-11',
14    '2015-07-12',
15    '2015-07-13',
16    '2015-07-14',
17];
18
19foreach ( $dates as $date )
20{
21    $dt = new DateTimeImmutable( "$date 00:00 UTC" );
22
23    echo $dt->format( "D Y-m-d H:i" ), " → ";
24
25    $dtn = $dt->modify( "this week" );
26
27    echo $dtn->format( "D Y-m-d H:i" ), "\n";
28}
29?>
30--EXPECT--
31Sat 2015-07-04 00:00 → Mon 2015-06-29 00:00
32Sun 2015-07-05 00:00 → Mon 2015-06-29 00:00
33Mon 2015-07-06 00:00 → Mon 2015-07-06 00:00
34Tue 2015-07-07 00:00 → Mon 2015-07-06 00:00
35Wed 2015-07-08 00:00 → Mon 2015-07-06 00:00
36Thu 2015-07-09 00:00 → Mon 2015-07-06 00:00
37Fri 2015-07-10 00:00 → Mon 2015-07-06 00:00
38Sat 2015-07-11 00:00 → Mon 2015-07-06 00:00
39Sun 2015-07-12 00:00 → Mon 2015-07-06 00:00
40Mon 2015-07-13 00:00 → Mon 2015-07-13 00:00
41Tue 2015-07-14 00:00 → Mon 2015-07-13 00:00
42