Skip to content

Commit

Permalink
EZP-32018: Fixed empty ezdate field transformation (#1464)
Browse files Browse the repository at this point in the history
* EZP-32018: Fixed empty ezdate field transformation

* EZP-32018: CS

* EZP-32018: CS
  • Loading branch information
Bartek authored Oct 12, 2020
1 parent f21bbc5 commit 9f16e49
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions lib/ezutils/classes/eztimestamp.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@ 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() );

Expand All @@ -28,6 +34,12 @@ 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() );

Expand Down

0 comments on commit 9f16e49

Please sign in to comment.