Bug #77733 [Com]: IntlDateFormatter parsing incorrectly
| From: | andorsarig at yahoo dot com | Date: | Wed, 22 May 2019 10:45:26 +0000 |
| Subject: | Bug #77733 [Com]: IntlDateFormatter parsing incorrectly | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-220940@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=77733&edit=1
ID: 77733
Comment by: andorsarig at yahoo dot com
Reported by: shariefjamiel at gmail dot com
Summary: IntlDateFormatter parsing incorrectly
Status: Open
Type: Bug
Package: Date/time related
Operating System: ubuntu 18.04 - php 7.2.15
PHP Version: 7.2.16
Block user comment: N
Private report: N
New Comment:
Experienced a similar problem.
For example:
- with 'en_US' locale the function returns false.
- with 'de_DE' returns a timestamp which points with 8 years and a few months later.
Previous Comments:
------------------------------------------------------------------------
[2019-03-13 09:00:04] shariefjamiel at gmail dot com
Description:
------------
---
From manual page: https://php.net/intldateformatter.parse
---
Passing a totally wrong datetime format returns a valid but strange datetime despite the date
formats being so different.
e.g. 2019-12-10 10:10:00 becomes 2016-06-10 09:10:00
If the date format is wrong to start with, should it not return null?
Test script:
---------------
use IntlDateFormatter;
$formatter = new IntlDateFormatter('en_GB', 3, 3, 'Europe/London', 0, null);
$date = '2019-12-10 10:10:00';
echo date('Y-m-d H:i:s', $formatter->parse($date));
Expected result:
----------------
null
Actual result:
--------------
2016-06-10 09:10:00
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=77733&edit=1