From 83191eb24d7100e6dab561a32f053b2fdc123ed4 Mon Sep 17 00:00:00 2001 From: kolaente Date: Sat, 22 Nov 2025 15:19:18 +0100 Subject: [PATCH] fix: add null/undefined handling in GanttChart.vue --- frontend/src/components/gantt/GanttChart.vue | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/frontend/src/components/gantt/GanttChart.vue b/frontend/src/components/gantt/GanttChart.vue index f60c255ac..efc30de73 100644 --- a/frontend/src/components/gantt/GanttChart.vue +++ b/frontend/src/components/gantt/GanttChart.vue @@ -40,7 +40,7 @@ >
([]) const ganttRows = ref([]) const cellsByRow = ref>({}) -function getRoundedDate(value: string | Date | undefined, fallback: Date, isStart: boolean) { +function getRoundedDate(value: string | Date | undefined, fallback: Date | string, isStart: boolean) { return roundToNaturalDayBoundary(value ? new Date(value) : new Date(fallback), isStart) } function transformTaskToGanttBar(t: ITask): GanttBarModel { - const startDate = getRoundedDate(t.startDate, props.defaultTaskStartDate, true) - const endDate = getRoundedDate(t.endDate, props.defaultTaskEndDate, false) + const startDate = getRoundedDate(t.startDate ?? undefined, props.defaultTaskStartDate, true) + const endDate = getRoundedDate(t.endDate ?? undefined, props.defaultTaskEndDate, false) const taskColor = getHexColor(t.hexColor) @@ -188,8 +188,8 @@ watch( return false } - const taskStart = getRoundedDate(task.startDate, props.defaultTaskStartDate, true) - const taskEnd = getRoundedDate(task.endDate, props.defaultTaskEndDate, false) + const taskStart = getRoundedDate(task.startDate ?? undefined, props.defaultTaskStartDate, true) + const taskEnd = getRoundedDate(task.endDate ?? undefined, props.defaultTaskEndDate, false) // Task is visible if it overlaps with the current date range return taskStart <= dateToDate.value