Bug #52283 [Opn->Asn]: IntlDateFormatter invalid parsing with YYYY
| From: | johannes@php.net | Date: | Thu, 08 Jul 2010 11:05:43 +0000 |
| Subject: | Bug #52283 [Opn->Asn]: IntlDateFormatter invalid parsing with YYYY | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-152220@lists.php.net to get a copy of this message | ||
Edit report at http://bugs.php.net/bug.php?id=52283&edit=1
ID: 52283
Updated by: johannes@php.net
Reported by: danikas2k2 at gmail dot com
Summary: IntlDateFormatter invalid parsing with YYYY
-Status: Open
+Status: Assigned
Type: Bug
Package: I18N and L10N related
Operating System: WinXP
PHP Version: 5.3.2
-Assigned To:
+Assigned To: stas
New Comment:
Stas, please look into this. Thanks. I don't know whether that might be
expected or is an icu issue or ...
Previous Comments:
------------------------------------------------------------------------
[2010-07-08 09:29:39] danikas2k2 at gmail dot com
Description:
------------
Parsing a value with YYYY in the pattern returns unexpected results.
Formatting
the value using the YYYY in the pattern works perfect.
Test script:
---------------
$fmt = new IntlDateFormatter('lt_LT', IntlDateFormatter::FULL,
IntlDateFormatter::FULL, 'Europe/Vilnius',
IntlDateFormatter::GREGORIAN);
$value = '2007-10-01'; // notice, that 2007-01-01 equals to 2007-W01-1
$variants = array();
$fmt->setPattern('yyyy');
$pts = $fmt->parse($value);
$variants[] = array($pts, $fmt->format($pts));
$fmt->setPattern('yyyy-MM');
$pts = $fmt->parse($value);
$variants[] = array($pts, $fmt->format($pts));
$fmt->setPattern('yyyy-MM-dd');
$pts = $fmt->parse($value);
$variants[] = array($pts, $fmt->format($pts));
$fmt->setPattern('YYYY');
$pts = $fmt->parse($value);
$variants[] = array($pts, $fmt->format($pts));
$fmt->setPattern('YYYY-MM');
$pts = $fmt->parse($value);
$variants[] = array($pts, $fmt->format($pts));
$fmt->setPattern('YYYY-MM-dd');
$pts = $fmt->parse($value);
$variants[] = array($pts, $fmt->format($pts));
print_r($variants);
Expected result:
----------------
array (
0 =>
array (
0 => 1167602400,
1 => '2007',
),
1 =>
array (
0 => 1191186000,
1 => '2007-10',
),
2 =>
array (
0 => 1191186000,
1 => '2007-10-01',
),
3 =>
array (
0 => 1167602400,
1 => '2007',
),
4 =>
array (
0 => 1191186000,
1 => '2007-10',
),
5 =>
array (
0 => 1191186000,
1 => '2007-10-01',
),
)
Actual result:
--------------
array (
0 =>
array (
0 => 1167602400,
1 => '2007',
),
1 =>
array (
0 => 1191186000,
1 => '2007-10',
),
2 =>
array (
0 => 1191186000,
1 => '2007-10-01',
),
3 =>
array (
0 => 1166997600,
1 => '2006',
),
4 =>
array (
0 => 1166997600,
1 => '2006-12',
),
5 =>
array (
0 => 23576400,
1 => '1970-10-01',
),
)
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/bug.php?id=52283&edit=1