From b4c11ce83985b0139b2ac63d1de851b6b892f7a2 Mon Sep 17 00:00:00 2001 From: Wahyu Ramadhan Date: Mon, 8 May 2023 14:20:44 +0700 Subject: [PATCH] overdue day count excluding holiday --- edit-mode/function/ganttConfig.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/edit-mode/function/ganttConfig.js b/edit-mode/function/ganttConfig.js index a9f9410..d7f317f 100644 --- a/edit-mode/function/ganttConfig.js +++ b/edit-mode/function/ganttConfig.js @@ -494,7 +494,18 @@ gantt.templates.task_end_date = function(date){ gantt.templates.rightside_text = function (start, end, task) { if (task.planned_end) { if (end.getTime() > task.planned_end.getTime()) { - var overdue = Math.ceil(Math.abs((end.getTime() - task.planned_end.getTime()) / (24 * 60 * 60 * 1000))); + var plannedEndDate = gantt.calculateEndDate({ + start_date: task.start_date, + duration: gantt.calculateDuration({ + start_date: task.start_date, + end_date: task.planned_end + }) + }); + var overdue = gantt.calculateDuration({ + start_date: plannedEndDate, + end_date: end, + task: task + }, 'day'); var text = "Overdue: " + overdue + " days"; return text; }