From e8333090dca92e87132c66526716c31376ba8b0b Mon Sep 17 00:00:00 2001 From: Wahyu Ramadhan Date: Thu, 24 Aug 2023 09:15:55 +0700 Subject: [PATCH] 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);