From 0dd336aec80318b08d21ff19516f644e4d63649a Mon Sep 17 00:00:00 2001 From: Aaryan Khandelwal Date: Wed, 6 Sep 2023 12:25:34 +0530 Subject: [PATCH] fix: don't render invalid dated issues --- .../gantt-chart/helpers/block-structure.tsx | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/web/components/gantt-chart/helpers/block-structure.tsx b/web/components/gantt-chart/helpers/block-structure.tsx index ab2475bdd..ea51c3b12 100644 --- a/web/components/gantt-chart/helpers/block-structure.tsx +++ b/web/components/gantt-chart/helpers/block-structure.tsx @@ -4,11 +4,13 @@ import { IGanttBlock } from "components/gantt-chart"; export const renderIssueBlocksStructure = (blocks: IIssue[]): IGanttBlock[] => blocks && blocks.length > 0 - ? blocks.map((block) => ({ - data: block, - id: block.id, - sort_order: block.sort_order, - start_date: new Date(block.start_date ?? ""), - target_date: new Date(block.target_date ?? ""), - })) + ? blocks + .filter((b) => new Date(b?.start_date ?? "") <= new Date(b?.target_date ?? "")) + .map((block) => ({ + data: block, + id: block.id, + sort_order: block.sort_order, + start_date: new Date(block.start_date ?? ""), + target_date: new Date(block.target_date ?? ""), + })) : [];