From 6dc44b2d25fe01720ce552dabc31e6cd330e99c0 Mon Sep 17 00:00:00 2001 From: barw4 Date: Mon, 12 Oct 2020 14:50:40 +0200 Subject: [PATCH 1/3] EZP-32018: Fixed empty ezdate field transformation --- lib/ezutils/classes/eztimestamp.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/ezutils/classes/eztimestamp.php b/lib/ezutils/classes/eztimestamp.php index fcbecd85b23..f2ea2f2127a 100644 --- a/lib/ezutils/classes/eztimestamp.php +++ b/lib/ezutils/classes/eztimestamp.php @@ -14,6 +14,9 @@ class eZTimestamp \return a timestamp in UTC */ public static function getUtcTimestampFromLocalTimestamp( $localTimestamp ) { + + if (!$localTimestamp) return null; + $utcTimezone = new \DateTimeZone( 'UTC' ); $localTimezone = new \DateTimeZone( date_default_timezone_get() ); @@ -28,6 +31,9 @@ public static function getUtcTimestampFromLocalTimestamp( $localTimestamp ) { \return a timestamp in timezone defined in php.ini */ public static function getLocalTimestampFromUtcTimestamp( $utcTimestamp ) { + + if (!$utcTimestamp) return null; + $utcTimezone = new \DateTimeZone( 'UTC' ); $localTimezone = new \DateTimeZone( date_default_timezone_get() ); From 07ae3ccdbcdcb44c141f24507de2efbd4b038922 Mon Sep 17 00:00:00 2001 From: barw4 Date: Mon, 12 Oct 2020 15:40:12 +0200 Subject: [PATCH 2/3] EZP-32018: CS --- lib/ezutils/classes/eztimestamp.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/ezutils/classes/eztimestamp.php b/lib/ezutils/classes/eztimestamp.php index f2ea2f2127a..2569936978a 100644 --- a/lib/ezutils/classes/eztimestamp.php +++ b/lib/ezutils/classes/eztimestamp.php @@ -15,7 +15,9 @@ class eZTimestamp */ public static function getUtcTimestampFromLocalTimestamp( $localTimestamp ) { - if (!$localTimestamp) return null; + if (!$localTimestamp) { + return null; + } $utcTimezone = new \DateTimeZone( 'UTC' ); $localTimezone = new \DateTimeZone( date_default_timezone_get() ); @@ -32,7 +34,9 @@ public static function getUtcTimestampFromLocalTimestamp( $localTimestamp ) { */ public static function getLocalTimestampFromUtcTimestamp( $utcTimestamp ) { - if (!$utcTimestamp) return null; + if (!$utcTimestamp) { + return null; + } $utcTimezone = new \DateTimeZone( 'UTC' ); $localTimezone = new \DateTimeZone( date_default_timezone_get() ); From 1226e4c9df174e5effdfb582f471cd56cf6a35bc Mon Sep 17 00:00:00 2001 From: barw4 Date: Mon, 12 Oct 2020 15:45:20 +0200 Subject: [PATCH 3/3] EZP-32018: CS --- lib/ezutils/classes/eztimestamp.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/ezutils/classes/eztimestamp.php b/lib/ezutils/classes/eztimestamp.php index 2569936978a..181d58f4644 100644 --- a/lib/ezutils/classes/eztimestamp.php +++ b/lib/ezutils/classes/eztimestamp.php @@ -15,7 +15,8 @@ class eZTimestamp */ public static function getUtcTimestampFromLocalTimestamp( $localTimestamp ) { - if (!$localTimestamp) { + if ( !$localTimestamp ) + { return null; } @@ -34,7 +35,8 @@ public static function getUtcTimestampFromLocalTimestamp( $localTimestamp ) { */ public static function getLocalTimestampFromUtcTimestamp( $utcTimestamp ) { - if (!$utcTimestamp) { + if ( !$utcTimestamp ) + { return null; }