From 27a552c3ea3634954f3a0397d2c53a1d6ec8f748 Mon Sep 17 00:00:00 2001 From: Shabnam Date: Sun, 7 Jun 2026 23:47:15 +0530 Subject: [PATCH] fix: use local date getters instead of toISOString() to prevent timezone date shift on task edit --- frontend/src/components/Task/TaskFormModal.jsx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/frontend/src/components/Task/TaskFormModal.jsx b/frontend/src/components/Task/TaskFormModal.jsx index c4dc0285..298ad1e5 100644 --- a/frontend/src/components/Task/TaskFormModal.jsx +++ b/frontend/src/components/Task/TaskFormModal.jsx @@ -54,8 +54,12 @@ export default function TaskFormModal({ if (task?.dueDate) { const dt = new Date(task.dueDate); - const datePart = dt.toISOString().slice(0, 10); // YYYY-MM-DD - const timePart = dt.toTimeString().slice(0, 5); // HH:MM + // Use local date getters to avoid UTC conversion shifting the date + const yyyy = dt.getFullYear(); + const mm = String(dt.getMonth() + 1).padStart(2, "0"); + const dd = String(dt.getDate()).padStart(2, "0"); + const datePart = `${yyyy}-${mm}-${dd}`; // YYYY-MM-DD in local time + const timePart = dt.toTimeString().slice(0, 5); // HH:MM in local time setDueDate(datePart); setDueTime(timePart);