Skip to content
Snippets Groups Projects
Commit 942b508d authored by Peter Rotich's avatar Peter Rotich
Browse files

timestamp: Return empty on invalid timestamp

parent a5ddd238
No related branches found
No related tags found
No related merge requests found
......@@ -522,7 +522,9 @@ class Format {
$format = self::getStrftimeFormat($format);
// Properly convert to user local time
$time = DateTime::createFromFormat('U', $timestamp, new DateTimeZone('UTC'));
if (!($time = DateTime::createFromFormat('U', $timestamp, new DateTimeZone('UTC'))))
return '';
$offset = $user_timezone->getOffset($time);
$timestamp = $time->getTimestamp() + $offset;
return strftime($format ?: $strftimeFallback, $timestamp);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment