From f3d5e7def3703ef605b313f417219ecc9abe00b1 Mon Sep 17 00:00:00 2001 From: Jayash Tripathy <76092296+JayashTripathy@users.noreply.github.com> Date: Fri, 19 Dec 2025 15:41:21 +0530 Subject: [PATCH] [WEB-5454] fix: optimize date validation logic in CycleCreateUpdateModal #8394 --- apps/web/core/components/cycles/modal.tsx | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/apps/web/core/components/cycles/modal.tsx b/apps/web/core/components/cycles/modal.tsx index 1a6855c13..3aeb9e592 100644 --- a/apps/web/core/components/cycles/modal.tsx +++ b/apps/web/core/components/cycles/modal.tsx @@ -136,14 +136,20 @@ export function CycleCreateUpdateModal(props: CycleModalProps) { if (payload.start_date && payload.end_date) { if (data?.id) { - // Update existing cycle - always include cycle_id for validation - isDateValid = await dateChecker(projectId, { - start_date: payload.start_date, - end_date: payload.end_date, - cycle_id: data.id, - }); + // Update existing cycle - only check dates if they've changed + const originalStartDate = renderFormattedPayloadDate(data.start_date) ?? null; + const originalEndDate = renderFormattedPayloadDate(data.end_date) ?? null; + const hasDateChanged = payload.start_date !== originalStartDate || payload.end_date !== originalEndDate; + + if (hasDateChanged) { + isDateValid = await dateChecker(projectId, { + start_date: payload.start_date, + end_date: payload.end_date, + cycle_id: data.id, + }); + } } else { - // Create new cycle - no cycle_id needed + // Create new cycle - always check dates isDateValid = await dateChecker(projectId, { start_date: payload.start_date, end_date: payload.end_date,