Skip to content

Commit fc87715

Browse files
committed
Added a test case for (docs) bug #74652
1 parent e7a7065 commit fc87715

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

ext/date/tests/bug74652.phpt

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
--TEST--
2+
Test for bug #74652: Incomplete dates
3+
--INI--
4+
date.timezone=UTC
5+
--FILE--
6+
<?php
7+
$formats = [
8+
'2017-03-25 10:52:09',
9+
'2017-03-25 10:52',
10+
'2017-03-25 10am',
11+
'2017-03-25',
12+
'2017-03',
13+
'2017.042',
14+
'2017043',
15+
];
16+
17+
foreach ( $formats as $format )
18+
{
19+
$dt = new DateTimeImmutable( $format );
20+
echo $dt->format( 'Y-m-d H:i:s' ), "\n";
21+
}
22+
?>
23+
--EXPECT--
24+
2017-03-25 10:52:09
25+
2017-03-25 10:52:00
26+
2017-03-25 10:00:00
27+
2017-03-25 00:00:00
28+
2017-03-01 00:00:00
29+
2017-02-11 00:00:00
30+
2017-02-12 00:00:00

0 commit comments

Comments
 (0)