Skip to content

Commit

Permalink
smarty API: Improve 536b8c4
Browse files Browse the repository at this point in the history
  • Loading branch information
ophian committed Jul 29, 2024
1 parent 8160a69 commit 4f1c59b
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions include/functions_smarty.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -822,8 +822,12 @@ function serendipity_smarty_formatTime($timestamp, $format, $useOffset = true, $
}
// Here we either have valid timestamps or datetime strings since they can happen in 'DigitalDateCreated', 'ExpirationDate' and ...?
if (is_string($timestamp) && strlen($timestamp) === 8) {
$dateTime = \DateTime::createFromFormat('Ymd|', $timestamp);
$timestamp = $dateTime->getTimestamp();
try {
$dateTime = \DateTime::createFromFormat('Ymd|', $timestamp);
$timestamp = $dateTime->getTimestamp();
} catch (Exception $e) {
return $timestamp;
}
}

if (defined($format)) {
Expand Down

0 comments on commit 4f1c59b

Please sign in to comment.