From 0b59ca61fa4b9f04ca45639ff7ba5a78929ef688 Mon Sep 17 00:00:00 2001 From: OCbwoy3 Date: Wed, 1 Jan 2025 00:24:52 +0200 Subject: [PATCH] update crontab executable so it's 2025 not 2024 --- hosts/default/apps/files/crontab-executable.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/hosts/default/apps/files/crontab-executable.ts b/hosts/default/apps/files/crontab-executable.ts index ddd093d..e12f640 100644 --- a/hosts/default/apps/files/crontab-executable.ts +++ b/hosts/default/apps/files/crontab-executable.ts @@ -36,7 +36,7 @@ function sendSpamNotifications() { function writeState(floorsSurvived: number) { const state = { - date: new Date().toISOString().split("T")[0], + date: new Date().toLocaleString("en-CA", { timeZoneName: "short" }).split(",")[0], floors: floorsSurvived, }; fs.writeFileSync(stateFilePath, JSON.stringify(state, null, 2)); @@ -45,7 +45,7 @@ function writeState(floorsSurvived: number) { function checkChallengeState() { if (fs.existsSync(stateFilePath)) { const state = JSON.parse(fs.readFileSync(stateFilePath, "utf-8")); - const today = new Date().toISOString().split("T")[0]; + const today = new Date().toLocaleString("en-CA", { timeZoneName: "short" }).split(",")[0]; const stateDate = state.date; const floorsSurvived = state.floors; @@ -65,11 +65,11 @@ function checkChallengeState() { } } else { sendReminderNotification(); - writeState(0); // Write state with 0 floors if the user hasn't played today + writeState(0); } } else { sendReminderNotification(); - writeState(0); // Write state with 0 floors if no state file exists + writeState(0); } }