From 4f1c59b9a7506ece457fe5a6199e2d05d052edc1 Mon Sep 17 00:00:00 2001 From: Ian Date: Mon, 29 Jul 2024 19:22:54 +0200 Subject: [PATCH] smarty API: Improve 536b8c4953845918afe403cf6d2c6202bd7922b9 --- include/functions_smarty.inc.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/include/functions_smarty.inc.php b/include/functions_smarty.inc.php index 80af07631..182afad2b 100644 --- a/include/functions_smarty.inc.php +++ b/include/functions_smarty.inc.php @@ -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)) {