Edit report at http://bugs.php.net/bug.php?id=52283&edit=1
ID: 52283 Updated by: johan...@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