Browse Source

fix duration

pull/1/head
Muhammad Sulaiman Yusuf 2 years ago
parent
commit
fc837efcc6
  1. 4
      edit-mode/function/restActivityLink.js

4
edit-mode/function/restActivityLink.js

@ -25,6 +25,7 @@ gantt.ajax.get({
}); });
function refresData(id){ function refresData(id){
console.log("refres triggered!!");
gantt.ajax.get({ gantt.ajax.get({
url: `${base_url}activity/${ganttId}/${proyekId}/get`, url: `${base_url}activity/${ganttId}/${proyekId}/get`,
headers: { headers: {
@ -85,6 +86,7 @@ var dp = gantt.createDataProcessor(function(entity, action, data, id) {
break; break;
case "update": case "update":
if(entity=="task"){ if(entity=="task"){
// let startDate = moment(data.start_date, "YYYY-MM-DD").subtract(1, "days");
let startDate = moment(data.start_date, "YYYY-MM-DD"); let startDate = moment(data.start_date, "YYYY-MM-DD");
data['start_date'] = startDate.format("YYYY-MM-DD")+" 00:00:00+07"; data['start_date'] = startDate.format("YYYY-MM-DD")+" 00:00:00+07";
let endDate = moment(data.end_date, "YYYY-MM-DD"); let endDate = moment(data.end_date, "YYYY-MM-DD");
@ -101,7 +103,7 @@ var dp = gantt.createDataProcessor(function(entity, action, data, id) {
return; return;
} }
data['duration'] = moment.duration(endDate.diff(startDate)).asDays()+1; data['duration'] += 1;
if(data && data.parent){ if(data && data.parent){
data['parent_id'] = data.parent; data['parent_id'] = data.parent;

Loading…
Cancel
Save