From da26affe26fda8d3be758c27b0b95e43b922acb2 Mon Sep 17 00:00:00 2001 From: Aaron Parecki Date: Wed, 1 Feb 2023 07:37:47 -0800 Subject: [PATCH] catch errors with invalid timezones closes #50 --- compass/resources/views/map.blade.php | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/compass/resources/views/map.blade.php b/compass/resources/views/map.blade.php index d60d624..3afd093 100644 --- a/compass/resources/views/map.blade.php +++ b/compass/resources/views/map.blade.php @@ -33,9 +33,18 @@
timezone); + } catch(Exception $e) { + $tz = new DateTimeZone('UTC'); + } + + $start = new DateTime($database->created_at); $end = new DateTime(); - $end->setTimeZone(new DateTimeZone($database->timezone)); + $start->setTimeZone($tz); + $end->setTimeZone($tz); + $i = clone $start; while((int)$i->format('Y') <= (int)$end->format('Y') && (int)$i->format('M') <= (int)$end->format('M')) { ?>