From fc837efcc6cbe8194178ceae72a4620db0bcae3d Mon Sep 17 00:00:00 2001 From: Muhammad Sulaiman Yusuf Date: Tue, 6 Dec 2022 17:40:43 +0700 Subject: [PATCH] fix duration --- edit-mode/function/restActivityLink.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/edit-mode/function/restActivityLink.js b/edit-mode/function/restActivityLink.js index da00b1c..f5078a1 100644 --- a/edit-mode/function/restActivityLink.js +++ b/edit-mode/function/restActivityLink.js @@ -25,6 +25,7 @@ gantt.ajax.get({ }); function refresData(id){ + console.log("refres triggered!!"); gantt.ajax.get({ url: `${base_url}activity/${ganttId}/${proyekId}/get`, headers: { @@ -85,6 +86,7 @@ var dp = gantt.createDataProcessor(function(entity, action, data, id) { break; case "update": if(entity=="task"){ + // let startDate = moment(data.start_date, "YYYY-MM-DD").subtract(1, "days"); let startDate = moment(data.start_date, "YYYY-MM-DD"); data['start_date'] = startDate.format("YYYY-MM-DD")+" 00:00:00+07"; let endDate = moment(data.end_date, "YYYY-MM-DD"); @@ -101,7 +103,7 @@ var dp = gantt.createDataProcessor(function(entity, action, data, id) { return; } - data['duration'] = moment.duration(endDate.diff(startDate)).asDays()+1; + data['duration'] += 1; if(data && data.parent){ data['parent_id'] = data.parent;