|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2017-04-28 17:53 UTC] requinix@php.net
-Status: Open
+Status: Not a bug
[2017-04-28 17:53 UTC] requinix@php.net
[2017-04-28 18:03 UTC] heiglandreas@php.net
[2017-04-28 18:04 UTC] jack dot peterson at gmail dot com
[2017-04-28 18:13 UTC] jack dot peterson at gmail dot com
[2017-04-28 18:40 UTC] heiglandreas@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Nov 05 00:00:02 2025 UTC |
Description: ------------ Given the format, 'Y-\WW', one should be able to construct a date such as 2017-W01 or 2017-W1 as a valid date where W is a number from 0-52 as documented for Date. The expected behavior here would be to create a valid date w/ the next least-significant values to be zeroed out. Current behavior is that one cannot construct a valid \DateTime from the requested format. Test script: --------------- public function testCanCreateDateFromFormat() { $format = 'Y-\WW'; $date = '2017-W01'; $obj = \DateTime::createFromFormat($format, $date); $this->assertInstanceOf(\DateTime::class, $obj); } testCanCreateDateFromFormat Failed asserting that false is an instance of class "DateTime". Expected result: ---------------- \DateTime::createFromFormat should return an instance of \DateTime Actual result: -------------- \DateTime::createFromFormat returns false in this scenario.