From a2b464af7b387121efe1e122eb59c6765377220d Mon Sep 17 00:00:00 2001 From: Ryan Kegel Date: Wed, 29 Apr 2026 14:17:40 -0400 Subject: [PATCH] fix: improve date comparison for chore completion status --- frontend/src/components/child/ChildView.vue | 10 +++++++--- frontend/src/components/child/ParentView.vue | 9 +++++++-- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/frontend/src/components/child/ChildView.vue b/frontend/src/components/child/ChildView.vue index 9541e27..bc0677b 100644 --- a/frontend/src/components/child/ChildView.vue +++ b/frontend/src/components/child/ChildView.vue @@ -224,9 +224,13 @@ const triggerTask = async (task: ChildTask) => { function isChoreCompletedToday(item: ChildTask): boolean { if (item.pending_status !== 'approved' || !item.approved_at) return false - const approvedDate = item.approved_at.substring(0, 10) - const today = new Date().toISOString().slice(0, 10) - return approvedDate === today + const approvedDate = new Date(item.approved_at) + const today = new Date() + return ( + approvedDate.getFullYear() === today.getFullYear() && + approvedDate.getMonth() === today.getMonth() && + approvedDate.getDate() === today.getDate() + ) } async function doConfirmChore() { diff --git a/frontend/src/components/child/ParentView.vue b/frontend/src/components/child/ParentView.vue index eeed94f..e611393 100644 --- a/frontend/src/components/child/ParentView.vue +++ b/frontend/src/components/child/ParentView.vue @@ -300,8 +300,13 @@ function handleChoreConfirmation(event: Event) { function isChoreCompletedToday(item: ChildTask): boolean { if (item.pending_status !== 'approved' || !item.approved_at) return false - const today = new Date().toISOString().slice(0, 10) - if (item.approved_at.slice(0, 10) !== today) return false + const approvedDate = new Date(item.approved_at) + const today = new Date() + const sameDay = + approvedDate.getFullYear() === today.getFullYear() && + approvedDate.getMonth() === today.getMonth() && + approvedDate.getDate() === today.getDate() + if (!sameDay) return false // If the task has a schedule and today is not a scheduled day, don't show as completed if (item.schedule && !isScheduledToday(item.schedule, new Date())) return false return true