Bug #69191 [Opn->Csd]: "ordinal week" (not "ordinal weeks") cannot be parsed
| From: | ryosuke_i_628 at yahoo dot co dot jp | Date: | Fri, 06 Mar 2015 11:27:03 +0000 |
| Subject: | Bug #69191 [Opn->Csd]: "ordinal week" (not "ordinal weeks") cannot be parsed | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-191208@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=69191&edit=1
ID: 69191
User updated by: ryosuke_i_628 at yahoo dot co dot jp
Reported by: ryosuke_i_628 at yahoo dot co dot jp
Summary: "ordinal week" (not "ordinal weeks") cannot be
parsed
-Status: Open
+Status: Closed
Type: Bug
Package: Date/time related
PHP Version: Irrelevant
Block user comment: N
Private report: N
New Comment:
I noticed that "week" was the invalid statement after I had submitted this issue. Very
sorry.
Previous Comments:
------------------------------------------------------------------------
[2015-03-06 11:19:44] mr dot bipinks at gmail dot com
(new \DateTime('first week'))->format('Y-m-d');
In the above line, DateTime('first week') is it valid statement?? I cant find any keyword
like "week" in the relative formats,check here: http://php.net/manual/de/datetime.formats.relative.php
instead i found "weeks", that worked so fine.
------------------------------------------------------------------------
[2015-03-05 08:56:01] ryosuke_i_628 at yahoo dot co dot jp
Description:
------------
"ordinal weeks" can be parsed, but "ordinal week" cannot.
That seems to be tried to parse as timezone name.
Test script:
---------------
<?php
try {
$results['first weeks'] = (new \DateTime('first
weeks'))->format('Y-m-d');
$results['first week'] = (new \DateTime('first
week'))->format('Y-m-d');
} catch (\Exception $e) {
$errors[] = $e->getMessage();
}
print_r(compact('results', 'errors'));
Expected result:
----------------
Array
(
[results] => Array
(
[first weeks] => 2015-03-12
[first week] => 2015-03-12
)
)
[Finished in 0.5s]
Actual result:
--------------
Array
(
[results] => Array
(
[first weeks] => 2015-03-12
)
[errors] => Array
(
[0] => DateTime::__construct(): Failed to parse time string (first week) at position
0 (f): The timezone could not be found in the database
)
)
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=69191&edit=1