Skip to content

armgit / plane

Public Imported from GitHub
0

πŸ”₯πŸ”₯πŸ”₯ Open-source Jira, Linear, Monday, and ClickUp alternative. Plane is a modern project management platform to manage tasks, sprints, docs, and triage.

[WEB-5454] fix: optimize date validation logic in CycleCreateUpdateModal #8394

Jayash Tripathyf3d5e7def370
diff --git a/apps/web/core/components/cycles/modal.tsx b/apps/web/core/components/cycles/modal.tsx
index 1a6855c13c..3aeb9e5925 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,