[Locale] remove support for era (BC|AD)

parsing it is a pain, nobody uses it, BC only works on 64 bit.
This commit is contained in:
Igor Wiedler 2011-02-28 13:25:21 +01:00 committed by Eriksen Costa
parent 195b2ebdde
commit 20acdac57d
3 changed files with 4 additions and 52 deletions

View File

@ -1,36 +0,0 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien.potencier@symfony-project.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Locale\Stub\DateFormat;
/**
* Parser and formatter for date formats
*
* @author Igor Wiedler <igor@wiedler.ch>
*/
class EraTransformer extends Transformer
{
public function format(\DateTime $dateTime, $length)
{
$year = (int) $dateTime->format('Y');
return $year >= 0 ? 'AD' : 'BC';
}
public function getReverseMatchingRegExp($length)
{
return "AD|BC";
}
public function extractDateOptions($matched, $length)
{
return array();
}
}

View File

@ -22,8 +22,8 @@ use Symfony\Component\Locale\Stub\DateFormat\MonthTransformer;
class FullTransformer
{
private $quoteMatch = "'(?:[^']+|'')*'";
private $implementedChars = 'MLydGQqhDEaHkKmsz';
private $notImplementedChars = 'YuwWFgecSAZvVW';
private $implementedChars = 'MLydQqhDEaHkKmsz';
private $notImplementedChars = 'GYuwWFgecSAZvVW';
private $regExp;
private $transformers;
@ -44,7 +44,6 @@ class FullTransformer
'L' => new MonthTransformer(),
'y' => new YearTransformer(),
'd' => new DayTransformer(),
'G' => new EraTransformer(),
'q' => new QuarterTransformer(),
'Q' => new QuarterTransformer(),
'h' => new Hour1201Transformer(),

View File

@ -57,11 +57,11 @@ class StubIntlDateFormatterTest extends LocaleTestCase
$formatData = array(
/* general */
array('y-M-d', 0, '1970-1-1'),
array("yyyy.MM.dd G 'at' HH:mm:ss zzz", 0, '1970.01.01 AD at 00:00:00 GMT+00:00'),
array("yyyy.MM.dd 'at' HH:mm:ss zzz", 0, '1970.01.01 at 00:00:00 GMT+00:00'),
array("EEE, MMM d, ''yy", 0, "Thu, Jan 1, '70"),
array('h:mm a', 0, '12:00 AM'),
array('K:mm a, z', 0, '0:00 AM, GMT+00:00'),
array('yyyyy.MMMM.dd GGG hh:mm aaa', 0, '01970.January.01 AD 12:00 AM'),
array('yyyyy.MMMM.dd hh:mm aaa', 0, '01970.January.01 12:00 AM'),
/* escaping */
array("'M'", 0, 'M'),
@ -99,9 +99,6 @@ class StubIntlDateFormatterTest extends LocaleTestCase
array('dd', 0, '01'),
array('ddd', 0, '001'),
/* era */
array('G', 0, 'AD'),
/* quarter */
array('Q', 0, '1'),
array('QQ', 0, '01'),
@ -233,14 +230,6 @@ class StubIntlDateFormatterTest extends LocaleTestCase
array('zzzzz', 0, 'GMT+00:00'),
);
// BC era has huge negative unix timestamp
// so testing it requires 64bit
if ($this->is64Bit()) {
$formatData = array_merge($formatData, array(
array('G', -62167222800, 'BC'),
));
}
return $formatData;
}