update crontab executable so it's 2025 not 2024

This commit is contained in:
2025-01-01 00:24:52 +02:00
parent 99f1b28bf9
commit 0b59ca61fa

View File

@@ -36,7 +36,7 @@ function sendSpamNotifications() {
function writeState(floorsSurvived: number) { function writeState(floorsSurvived: number) {
const state = { const state = {
date: new Date().toISOString().split("T")[0], date: new Date().toLocaleString("en-CA", { timeZoneName: "short" }).split(",")[0],
floors: floorsSurvived, floors: floorsSurvived,
}; };
fs.writeFileSync(stateFilePath, JSON.stringify(state, null, 2)); fs.writeFileSync(stateFilePath, JSON.stringify(state, null, 2));
@@ -45,7 +45,7 @@ function writeState(floorsSurvived: number) {
function checkChallengeState() { function checkChallengeState() {
if (fs.existsSync(stateFilePath)) { if (fs.existsSync(stateFilePath)) {
const state = JSON.parse(fs.readFileSync(stateFilePath, "utf-8")); 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 stateDate = state.date;
const floorsSurvived = state.floors; const floorsSurvived = state.floors;
@@ -65,11 +65,11 @@ function checkChallengeState() {
} }
} else { } else {
sendReminderNotification(); sendReminderNotification();
writeState(0); // Write state with 0 floors if the user hasn't played today writeState(0);
} }
} else { } else {
sendReminderNotification(); sendReminderNotification();
writeState(0); // Write state with 0 floors if no state file exists writeState(0);
} }
} }