diff --git a/src/Bundle/ChillMainBundle/Service/RollingDate/RollingDate.php b/src/Bundle/ChillMainBundle/Service/RollingDate/RollingDate.php index 876c9dea3..e2657cde5 100644 --- a/src/Bundle/ChillMainBundle/Service/RollingDate/RollingDate.php +++ b/src/Bundle/ChillMainBundle/Service/RollingDate/RollingDate.php @@ -63,7 +63,7 @@ class RollingDate final public const T_YEAR_PREVIOUS_START = 'year_previous_start'; - private const NORMALIZATION_FORMAT = 'd-m-Y-H:i:s.u T'; + private const NORMALIZATION_FORMAT = 'Y-m-d-H:i:s.u e'; /** * @param string|self::T_* $roll @@ -95,7 +95,7 @@ class RollingDate return [ 'roll' => $this->getRoll(), 'fixed_date' => $this->getFixedDate()?->format(self::NORMALIZATION_FORMAT), - 'pivot_date' => $this->getPivotDate()->format(self::NORMALIZATION_FORMAT), + 'pivot_date' => $this->getPivotDate()?->format(self::NORMALIZATION_FORMAT), 'v' => 1, ]; } diff --git a/src/Bundle/ChillMainBundle/Tests/Services/RollingDate/RollingDateTest.php b/src/Bundle/ChillMainBundle/Tests/Services/RollingDate/RollingDateTest.php index 3c7d01360..bd80e9ae8 100644 --- a/src/Bundle/ChillMainBundle/Tests/Services/RollingDate/RollingDateTest.php +++ b/src/Bundle/ChillMainBundle/Tests/Services/RollingDate/RollingDateTest.php @@ -29,17 +29,18 @@ class RollingDateTest extends TestCase self::assertEquals(RollingDate::T_YEAR_PREVIOUS_START, $actual->getRoll()); self::assertNull($actual->getFixedDate()); - self::assertEquals($date->getPivotDate()->getTimestamp(), $actual->getPivotDate()->getTimestamp()); + self::assertEquals($date->getPivotDate()?->getTimestamp(), $actual->getPivotDate()?->getTimestamp()); } public function testNormalizationDenormalizationProcessWithPivotDate(): void { - $date = new RollingDate(RollingDate::T_FIXED_DATE, $pivot = new \DateTimeImmutable('now')); + $date = new RollingDate(RollingDate::T_FIXED_DATE, $fixed = new \DateTimeImmutable('now')); $actual = RollingDate::fromNormalized($date->normalize()); self::assertEquals(RollingDate::T_FIXED_DATE, $actual->getRoll()); - self::assertEquals($pivot, $actual->getFixedDate()); - self::assertEquals($date->getPivotDate()->getTimestamp(), $actual->getPivotDate()->getTimestamp()); + self::assertEquals($fixed, $actual->getFixedDate()); + self::assertEquals($date->getPivotDate()?->getTimestamp(), $actual->getPivotDate()?->getTimestamp()); } + }