Skip to content

Commit 9f16e49

Browse files
author
Bartek
authored
EZP-32018: Fixed empty ezdate field transformation (#1464)
* EZP-32018: Fixed empty ezdate field transformation * EZP-32018: CS * EZP-32018: CS
1 parent f21bbc5 commit 9f16e49

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

lib/ezutils/classes/eztimestamp.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,12 @@ class eZTimestamp
1414
\return a timestamp in UTC
1515
*/
1616
public static function getUtcTimestampFromLocalTimestamp( $localTimestamp ) {
17+
18+
if ( !$localTimestamp )
19+
{
20+
return null;
21+
}
22+
1723
$utcTimezone = new \DateTimeZone( 'UTC' );
1824
$localTimezone = new \DateTimeZone( date_default_timezone_get() );
1925

@@ -28,6 +34,12 @@ public static function getUtcTimestampFromLocalTimestamp( $localTimestamp ) {
2834
\return a timestamp in timezone defined in php.ini
2935
*/
3036
public static function getLocalTimestampFromUtcTimestamp( $utcTimestamp ) {
37+
38+
if ( !$utcTimestamp )
39+
{
40+
return null;
41+
}
42+
3143
$utcTimezone = new \DateTimeZone( 'UTC' );
3244
$localTimezone = new \DateTimeZone( date_default_timezone_get() );
3345

0 commit comments

Comments
 (0)