Supporting %e in windows. Fixes #1510.

This commit is contained in:
Juan Basso 2011-02-06 15:51:28 -02:00
parent 8d5e68d582
commit f2a4b1e959
2 changed files with 17 additions and 0 deletions

View file

@ -79,6 +79,15 @@ class TimeHelper extends AppHelper {
return sprintf("%02d", date('Y', $this->__time) / 100);
case 'D':
return '%m/%d/%y';
case 'e':
if (DS === '/') {
return '%e';
}
$day = date('j', $this->__time);
if ($day < 10) {
$day = ' ' . $day;
}
return $day;
case 'eS' :
return date('jS', $this->__time);
case 'b':

View file

@ -731,6 +731,14 @@ class TimeHelperTest extends CakeTestCase {
$expected = 4;
$this->assertEqual($result, $expected);
$result = $this->Time->convertSpecifiers('%e', $time);
$expected = '14';
$this->assertEqual($result, $expected);
$result = $this->Time->convertSpecifiers('%e', strtotime('2011-01-01'));
$expected = ' 1';
$this->assertEqual($result, $expected);
$result = $this->Time->convertSpecifiers('%x', $time);
$expected = '%d/%m/%y';
$this->assertEqual($result, $expected);