From 5a98cf585ab554318123ce71b5c91f5798c4b458 Mon Sep 17 00:00:00 2001
From: Felix Eckhofer <felix@eckhofer.com>
Date: Thu, 19 Dec 2024 21:32:40 +0100
Subject: [PATCH] Avoid JS error when not on current day

---
 app/views/conferences/show.html.erb | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/app/views/conferences/show.html.erb b/app/views/conferences/show.html.erb
index f5c4bf3..f263a33 100644
--- a/app/views/conferences/show.html.erb
+++ b/app/views/conferences/show.html.erb
@@ -80,6 +80,10 @@ current_time = Time.zone.now.in_time_zone(@conference.time_zone)
             const pixelsPerHour = <%= pixels_per_hour %>;
             const currentTimeDiv = document.querySelector('#<%= date.strftime('day-%Y-%m-%d') %> .current-time');
 
+            if (!currentTimeDiv) {
+              return;
+            }
+
             if (
               currentTime.toDateString() === timelineStartsAt.toDateString() &&
               currentTime >= timelineStartsAt &&
-- 
GitLab