From e8333090dca92e87132c66526716c31376ba8b0b Mon Sep 17 00:00:00 2001 From: Wahyu Ramadhan Date: Thu, 24 Aug 2023 09:15:55 +0700 Subject: [PATCH 1/2] Fix gantt date format --- edit-mode/function/ganttConfig.js | 35 +++++++++++++++++++++++-------- 1 file changed, 26 insertions(+), 9 deletions(-) diff --git a/edit-mode/function/ganttConfig.js b/edit-mode/function/ganttConfig.js index 250c8e7..00d6155 100644 --- a/edit-mode/function/ganttConfig.js +++ b/edit-mode/function/ganttConfig.js @@ -280,24 +280,41 @@ var allColumns = [ { name: "planned_start", label: "Baseline Start", align: "center", min_width: 80, editor: editor.planned_start, resize: true, template: function (text) { if (!text.planned_start) { - return text.start_date; + return moment(text.start_date).format("DD-MM-YYYY"); } - return text.planned_start; + return moment(text.planned_start).format("DD-MM-YYYY"); } }, { name: "planned_end", label: "Baseline Finish", align: "center", min_width: 80, editor: editor.planned_end, resize: true, template: function (text) { if (!text.planned_end) { - return text.end_date; + return moment(text.end_date).format("DD-MM-YYYY"); } - return text.planned_end; + return moment(text.planned_end).format("DD-MM-YYYY"); } }, - { name: "start_date", label: "Early Start", align: "center", min_width: 80, editor: editor.start_date, resize: true }, - { name: "end_date", label: "Early Finish", align: "center", min_width: 80, editor: editor.end_date, resize: true }, - - { name: "actual_start", label: "Actual Start", align: "center", min_width: 80, resize: true }, - { name: "actual_end", label: "Actual Finish", align: "center", min_width: 80, resize: true }, + { name: "start_date", label: "Early Start", align: "center", min_width: 80, editor: editor.start_date, resize: true, template: function (text) { + return moment(text.start_date).format("DD-MM-YYYY"); + } + }, + { name: "end_date", label: "Early Finish", align: "center", min_width: 80, editor: editor.end_date, resize: true, template: function (text) { + return moment(text.end_date).format("DD-MM-YYYY"); + } + }, + { name: "actual_start", label: "Actual Start", align: "center", min_width: 80, resize: true, template: function (text) { + if (!text.actual_start) { + return ''; + } + return moment(text.actual_start).format("DD-MM-YYYY"); + } + }, + { name: "actual_end", label: "Actual Finish", align: "center", min_width: 80, resize: true, template: function (text) { + if (!text.actual_end) { + return ''; + } + return moment(text.actual_end).format("DD-MM-YYYY"); + } + }, { name: "bobot_planning", label: "Bobot (%)", align: "center", editor: editor.bobot_planning, resize: true, min_width: 115, template: function (text) { let bobot = parseFloat(text.bobot_planning); From 9a016c2509e1e55593100f4a392026b9531c1e30 Mon Sep 17 00:00:00 2001 From: Wahyu Ramadhan Date: Thu, 24 Aug 2023 10:41:20 +0700 Subject: [PATCH 2/2] Check link type --- edit-mode/function/function.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/edit-mode/function/function.js b/edit-mode/function/function.js index c84423e..1319ab7 100644 --- a/edit-mode/function/function.js +++ b/edit-mode/function/function.js @@ -717,7 +717,9 @@ function updateLinksLag(data) { let predecessor = data.data.find(item => item.id == link.source); if (predecessor) { let lag = gantt.calculateDuration(new Date(predecessor.end_date), new Date(task.start_date)); - link.lag = lag; + if (link.type == "0") { + link.lag = lag; + } } } });