diff --git a/src/Model/Common/DateDecorator.php b/src/Model/Common/DateDecorator.php index 971ea9212c..85c9bcb497 100644 --- a/src/Model/Common/DateDecorator.php +++ b/src/Model/Common/DateDecorator.php @@ -12,6 +12,6 @@ class DateDecorator extends DateTimeDecorator { public function jsonSerialize() { - return $this->getUtcDateTime()->format('Y-m-d'); + return $this->getDateTime()->format('Y-m-d'); } } diff --git a/tests/unit/Model/Common/DateDecoratorTest.php b/tests/unit/Model/Common/DateDecoratorTest.php index 16f77816a4..8dd58cb145 100644 --- a/tests/unit/Model/Common/DateDecoratorTest.php +++ b/tests/unit/Model/Common/DateDecoratorTest.php @@ -14,4 +14,15 @@ public function testJsonSerialize() $decorator->setDateTime(new \DateTime('2015-01-01 12:00', $timezone)); $this->assertSame('2015-01-01', $decorator->jsonSerialize()); } + + public function testDateOverflow() + { + $timezone = new \DateTimeZone('CET'); + $expected = $time = new \DateTime('2015-01-01', $timezone); + $decorator = new DateDecorator($time); + + $date = $decorator->jsonSerialize(); + $test = new DateDecorator(new \DateTime($date, $timezone)); + $this->assertEquals($expected, $test->getDateTime()); + } }