Merge pull request #2101 from makeplane/fix/gantt_issues

fix: don't render invalid dated blocks on the gantt chart
This commit is contained in:
sriram veeraghanta 2023-09-06 15:00:03 +05:30 committed by GitHub
commit b46a7481ae
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 16 additions and 9 deletions

View File

@ -63,7 +63,9 @@ export const CyclesListGanttChartView: FC<Props> = ({ cycles, mutateCycles }) =>
const blockFormat = (blocks: ICycle[]) => const blockFormat = (blocks: ICycle[]) =>
blocks && blocks.length > 0 blocks && blocks.length > 0
? blocks ? blocks
.filter((b) => b.start_date && b.end_date) .filter(
(b) => b.start_date && b.end_date && new Date(b.start_date) <= new Date(b.end_date)
)
.map((block) => ({ .map((block) => ({
data: block, data: block,
id: block.id, id: block.id,

View File

@ -4,7 +4,9 @@ import { IGanttBlock } from "components/gantt-chart";
export const renderIssueBlocksStructure = (blocks: IIssue[]): IGanttBlock[] => export const renderIssueBlocksStructure = (blocks: IIssue[]): IGanttBlock[] =>
blocks && blocks.length > 0 blocks && blocks.length > 0
? blocks.map((block) => ({ ? blocks
.filter((b) => new Date(b?.start_date ?? "") <= new Date(b?.target_date ?? ""))
.map((block) => ({
data: block, data: block,
id: block.id, id: block.id,
sort_order: block.sort_order, sort_order: block.sort_order,

View File

@ -69,7 +69,10 @@ export const ModulesListGanttChartView: FC<Props> = ({ modules, mutateModules })
const blockFormat = (blocks: IModule[]) => const blockFormat = (blocks: IModule[]) =>
blocks && blocks.length > 0 blocks && blocks.length > 0
? blocks ? blocks
.filter((b) => b.start_date && b.target_date) .filter(
(b) =>
b.start_date && b.target_date && new Date(b.start_date) <= new Date(b.target_date)
)
.map((block) => ({ .map((block) => ({
data: block, data: block,
id: block.id, id: block.id,