Skip to content
Permalink
Browse files

Forward port fixes for #4294 from 1.3 to 2.x

CakeTime was broken in the same way as TimeHelper was in 1.x. Getting
1969 on invalid input can be very confusing and un-helpful.

Refs #4294
  • Loading branch information...
markstory committed Aug 19, 2014
1 parent 07937d5 commit 0400a630046430d43c60c346e1661618d3a00574
Showing with 9 additions and 0 deletions.
  1. +6 −0 lib/Cake/Test/Case/Utility/CakeTimeTest.php
  2. +3 −0 lib/Cake/Utility/CakeTime.php
@@ -597,6 +597,12 @@ public function testFormat() {
$result = $this->Time->format('Y-m-d', null, 'never');
$this->assertEquals('never', $result);
$result = $this->Time->format('Y-m-d', '');
$this->assertSame('', $result);
$result = $this->Time->format('Y-m-d', false);
$this->assertSame('', $result);
$result = $this->Time->format('2012-01-13', '%d-%m-%Y', 'invalid');
$this->assertEquals('13-01-2012', $result);
@@ -1053,6 +1053,9 @@ public static function i18nFormat($date, $format = null, $default = false, $time
if ($date === false && $default !== false) {
return $default;
}
if ($date === false) {
return '';
}
if (empty($format)) {
$format = '%x';
}

0 comments on commit 0400a63

Please sign in to comment.
You can’t perform that action at this time.