date managermaent fix to use local for comparisons.

This commit is contained in:
2026-02-05 09:53:56 -06:00
parent fc3f1066e1
commit 61f0f2185a
+5 -5
View File
@@ -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;
}