Skip to content

Commit

Permalink
Supporting %e in windows. Fixes cakephp#1510.
Browse files Browse the repository at this point in the history
  • Loading branch information
jrbasso committed Feb 6, 2011
1 parent 8d5e68d commit f2a4b1e
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
9 changes: 9 additions & 0 deletions cake/libs/view/helpers/time.php
Expand Up @@ -79,6 +79,15 @@ function __translateSpecifier($specifier) {
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':
Expand Down
8 changes: 8 additions & 0 deletions cake/tests/cases/libs/view/helpers/time.test.php
Expand Up @@ -731,6 +731,14 @@ function testConvertSpecifiers() {
$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);
Expand Down

0 comments on commit f2a4b1e

Please sign in to comment.