From c611fe38c9097e628866b6b5a00ba913b967e482 Mon Sep 17 00:00:00 2001 From: Jonathan Bobel Date: Mon, 27 Nov 2023 16:19:54 -0500 Subject: [PATCH] 945 - Fixed the javascript so it's not breaking every page this element is not on --- app/assets/javascripts/date.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/app/assets/javascripts/date.js b/app/assets/javascripts/date.js index 1d6a0d353..59a67c501 100644 --- a/app/assets/javascripts/date.js +++ b/app/assets/javascripts/date.js @@ -1,9 +1,10 @@ (function (window) { - "use strict"; // Show the current year - document.getElementById("current-year").innerHTML = new Date().getFullYear(); + const currentYearElement = document.getElementById("current-year"); - -})(window); + if (currentYearElement) { + currentYearElement.textContent = new Date().getFullYear(); + } +})(window); \ No newline at end of file