Browse Source

Fix conversion of ICU 'L' symbol.

L should not contain a leading zero.
Added a test for this too.

close #7761
tags/2.0.4
Nikola Kovacs 10 years ago committed by Carsten Brandt
parent
commit
b31b9e2411
  1. 1
      framework/CHANGELOG.md
  2. 4
      framework/helpers/BaseFormatConverter.php
  3. 2
      tests/framework/helpers/FormatConverterTest.php

1
framework/CHANGELOG.md

@ -14,6 +14,7 @@ Yii Framework 2 Change Log
- Bug #7603: Fixed escape characters in `FormatConverter` to work with unicode characters (maddoger, cebe) - Bug #7603: Fixed escape characters in `FormatConverter` to work with unicode characters (maddoger, cebe)
- Bug #7656: Fixed `yii\rbac\DbManager::getRolesByUser()` and `yii\rbac\PhpManager::getRolesByUser()` to return roles only (samdark) - Bug #7656: Fixed `yii\rbac\DbManager::getRolesByUser()` and `yii\rbac\PhpManager::getRolesByUser()` to return roles only (samdark)
- Bug #7757: Fix fetching tables schema for oci and mysql when PDO::ATTR_CASE is set (nineinchnick) - Bug #7757: Fix fetching tables schema for oci and mysql when PDO::ATTR_CASE is set (nineinchnick)
- Bug #7761: Fixed formatting one digit month in date formatter using ICU format `L` (nkovacs)
- Bug #7775: Added more strict check on controller IDs when they are being used to create controller instances on Windows (Bhoft, qiangxue) - Bug #7775: Added more strict check on controller IDs when they are being used to create controller instances on Windows (Bhoft, qiangxue)
- Bug #7831: Add order when fetching database table names and constraints (nineinchnick) - Bug #7831: Add order when fetching database table names and constraints (nineinchnick)
- Bug #7846: Fixed `yii\base\Model` does not recognize scenario declared by rules using 'except' (klimov-paul) - Bug #7846: Fixed `yii\base\Model` does not recognize scenario declared by rules using 'except' (klimov-paul)

4
framework/helpers/BaseFormatConverter.php

@ -153,7 +153,7 @@ class BaseFormatConverter
'MMM' => 'M', // A short textual representation of a month, three letters 'MMM' => 'M', // A short textual representation of a month, three letters
'MMMM' => 'F', // A full textual representation of a month, such as January or March 'MMMM' => 'F', // A full textual representation of a month, such as January or March
'MMMMM' => '', // 'MMMMM' => '', //
'L' => 'm', // Stand alone month in year 'L' => 'n', // Stand alone month in year
'LL' => 'm', // Stand alone month in year 'LL' => 'm', // Stand alone month in year
'LLL' => 'M', // Stand alone month in year 'LLL' => 'M', // Stand alone month in year
'LLLL' => 'F', // Stand alone month in year 'LLLL' => 'F', // Stand alone month in year
@ -363,7 +363,7 @@ class BaseFormatConverter
'MMM' => 'M', // A short textual representation of a month, three letters 'MMM' => 'M', // A short textual representation of a month, three letters
'MMMM' => 'MM', // A full textual representation of a month, such as January or March 'MMMM' => 'MM', // A full textual representation of a month, such as January or March
'MMMMM' => '', // 'MMMMM' => '', //
'L' => 'mm', // Stand alone month in year 'L' => 'm', // Stand alone month in year
'LL' => 'mm', // Stand alone month in year 'LL' => 'mm', // Stand alone month in year
'LLL' => 'M', // Stand alone month in year 'LLL' => 'M', // Stand alone month in year
'LLLL' => 'MM', // Stand alone month in year 'LLLL' => 'MM', // Stand alone month in year

2
tests/framework/helpers/FormatConverterTest.php

@ -55,6 +55,7 @@ class FormatConverterTest extends TestCase
$formatter = new Formatter(['locale' => 'en-US']); $formatter = new Formatter(['locale' => 'en-US']);
$this->assertEquals('24.8.2014', $formatter->asDate('2014-8-24', 'php:d.n.Y')); $this->assertEquals('24.8.2014', $formatter->asDate('2014-8-24', 'php:d.n.Y'));
$this->assertEquals('24.8.2014', $formatter->asDate('2014-8-24', 'd.M.yyyy')); $this->assertEquals('24.8.2014', $formatter->asDate('2014-8-24', 'd.M.yyyy'));
$this->assertEquals('24.8.2014', $formatter->asDate('2014-8-24', 'd.L.yyyy'));
} }
public function testOneDigitIcu() public function testOneDigitIcu()
@ -62,6 +63,7 @@ class FormatConverterTest extends TestCase
$formatter = new Formatter(['locale' => 'en-US']); $formatter = new Formatter(['locale' => 'en-US']);
$this->assertEquals('24.8.2014', $formatter->asDate('2014-8-24', 'php:d.n.Y')); $this->assertEquals('24.8.2014', $formatter->asDate('2014-8-24', 'php:d.n.Y'));
$this->assertEquals('24.8.2014', $formatter->asDate('2014-8-24', 'd.M.yyyy')); $this->assertEquals('24.8.2014', $formatter->asDate('2014-8-24', 'd.M.yyyy'));
$this->assertEquals('24.8.2014', $formatter->asDate('2014-8-24', 'd.L.yyyy'));
} }
public function testIntlUtf8Ru() public function testIntlUtf8Ru()

Loading…
Cancel
Save