Skip to content
Permalink
Browse files

Change date's default json encode format to valid ISO8601.

  • Loading branch information...
ADmad committed Apr 21, 2016
1 parent 553bd5d commit cb642f3417b2f2ef8292f98a0686f6fbae0603be
Showing with 3 additions and 3 deletions.
  1. +1 −1 src/I18n/DateFormatTrait.php
  2. +1 −1 tests/TestCase/I18n/DateTest.php
  3. +1 −1 tests/TestCase/I18n/TimeTest.php
@@ -54,7 +54,7 @@ trait DateFormatTrait
* @var string|array|int
* @see \Cake\I18n\Time::i18nFormat()
*/
protected static $_jsonEncodeFormat = "yyyy-MM-dd'T'HH:mm:ssZ";
protected static $_jsonEncodeFormat = "yyyy-MM-dd'T'HH:mm:ssxxx";
/**
* Caches whether or not this class is a subclass of a Date or MutableDate
@@ -151,7 +151,7 @@ public function testNice($class)
public function testJsonSerialize($class)
{
$date = new $class('2015-11-06 11:32:45');
$this->assertEquals('"2015-11-06T00:00:00+0000"', json_encode($date));
$this->assertEquals('"2015-11-06T00:00:00+00:00"', json_encode($date));
}
/**
@@ -711,7 +711,7 @@ public function testDiffForHumansNow($class)
public function testJsonEnconde($class)
{
$time = new $class('2014-04-20 10:10:10');
$this->assertEquals('"2014-04-20T10:10:10+0000"', json_encode($time));
$this->assertEquals('"2014-04-20T10:10:10+00:00"', json_encode($time));
$class::setJsonEncodeFormat('yyyy-MM-dd HH:mm:ss');
$this->assertEquals('"2014-04-20 10:10:10"', json_encode($time));

0 comments on commit cb642f3

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