From 5c366aa980e8cd7a18de38f2d0ed2d1213a66f17 Mon Sep 17 00:00:00 2001 From: Tanooki Mario Date: Sun, 29 Oct 2023 12:56:09 -0400 Subject: [PATCH] Ensure October doesn't get a leading "0" when creating the datestring. This results in datestrings like "2023-010-29T16:24:31", which are invalid because the month 010 doesn't exist. --- scripts/timer.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/timer.js b/scripts/timer.js index 6ad3ff9..dc66978 100644 --- a/scripts/timer.js +++ b/scripts/timer.js @@ -232,7 +232,7 @@ new MutationObserver(checkStatusOnLoad).observe(document.getElementsByClassName( function getRecentDate(time) { let now = new Date(); - const dateString = `${now.getFullYear()}-${(now.getMonth() < 10 ? '0' : '') + (1 + now.getMonth())}-${(now.getDate() < 10 ? '0' : '') + now.getDate()}T${time}`; + const dateString = `${now.getFullYear()}-${(now.getMonth() < 9 ? '0' : '') + (1 + now.getMonth())}-${(now.getDate() < 10 ? '0' : '') + now.getDate()}T${time}`; let fullDate = Date.parse(dateString); while (fullDate > Date.now()) { fullDate -= 24 * 60 * 60 * 1000;