mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-19 02:56:15 +00:00
Supporting %e in windows. Fixes #1510.
This commit is contained in:
parent
8d5e68d582
commit
f2a4b1e959
2 changed files with 17 additions and 0 deletions
|
@ -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':
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Add table
Reference in a new issue