From 61f0f2185ab5441b8f1d4262963b225fddc91217 Mon Sep 17 00:00:00 2001 From: Timothy Cardoza Date: Thu, 5 Feb 2026 09:53:56 -0600 Subject: [PATCH] date managermaent fix to use local for comparisons. --- src/store/index.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/store/index.ts b/src/store/index.ts index 6c623b7..e3a17b3 100644 --- a/src/store/index.ts +++ b/src/store/index.ts @@ -38,7 +38,7 @@ export interface Task { export const checkRecurringTasks = () => { const tasks = store.tasks; const nowObj = new Date(); - const todayStr = nowObj.toISOString().split('T')[0]; + const todayStr = nowObj.toLocaleDateString('en-CA'); // YYYY-MM-DD in local time tasks.forEach(task => { if (!task.completed || !task.recurrence) return; @@ -51,14 +51,14 @@ export const checkRecurringTasks = () => { // Check if we already reset it today/this cycle if (lastUncompleted) { - const lastDate = new Date(lastUncompleted).toISOString().split('T')[0]; + const lastDate = new Date(lastUncompleted).toLocaleDateString('en-CA'); if (lastDate === todayStr) return; // Already reset today } // Also check 'updated' date. If it was marked completed TODAY, don't reset immediately. // We only reset if the completion happened BEFORE the current cycle trigger. // E.g. Completed yesterday, today is a new day -> Reset. - const updatedDate = new Date(task.updated).toISOString().split('T')[0]; + const updatedDate = new Date(task.updated).toLocaleDateString('en-CA'); if (updatedDate === todayStr) { // If manual loop: user completes it, we shouldn't immediately uncomplete it. // But what if it's supposed to be uncompleted today? @@ -210,8 +210,8 @@ export const matchesFilter = (task: Task) => { // Edited Today if (f.editedToday) { - const today = new Date().toISOString().split('T')[0]; - const updated = new Date(task.updated).toISOString().split('T')[0]; + const today = new Date().toLocaleDateString('en-CA'); + const updated = new Date(task.updated).toLocaleDateString('en-CA'); if (today !== updated) return false; }