From 1cfc7038e46d287f1afe4b710ba4cae409da842d Mon Sep 17 00:00:00 2001 From: Wahyu Ramadhan Date: Thu, 20 Jul 2023 08:53:08 +0700 Subject: [PATCH] Fix lag --- edit-mode/function/restActivityLink.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/edit-mode/function/restActivityLink.js b/edit-mode/function/restActivityLink.js index eddfb0c..7a1115c 100644 --- a/edit-mode/function/restActivityLink.js +++ b/edit-mode/function/restActivityLink.js @@ -162,10 +162,14 @@ var dp = gantt.createDataProcessor(function(entity, action, data, id) { } }); } - data['duration'] = gantt.calculateDuration({ - start_date: new Date(data['start_date']), - end_date: new Date(data['end_date']) - }); + let newStart = new Date(data['start_date']); + let newEnd = new Date(data['end_date']); + if (data['start_date'] && data['end_date']) { + data['duration'] = gantt.calculateDuration({ + start_date: newStart, + end_date: newEnd + }); + } data['geom'] = geom.find(obj => obj.activity_id == id)?.geom; return gantt.ajax.put({ headers: {