Gantt autoschedule doesn't change datas

Hello, I need some information about the autoSchedule method.

I am trying to switch from falsy work time to true work time and to autoSchedule the project in order to set the good datas.
I didn’t create a stackblitz but I will show you the result of commands that i ran one after the other.

gantt.config.work_time
true

gantt.getTaskByIndex(2)
{

start_date: Thu Aug 15 2019 00:00:00 GMT+0200 (heure d’été d’Europe centrale) {}
duration: 4
end_date: Mon Aug 19 2019 00:00:00 GMT+0200 (heure d’été d’Europe centrale) {}
constraint_type: “asap”

}

gantt.calculateEndDate(gantt.getTaskByIndex(2))
Wed Aug 21 2019 00:00:00 GMT+0200 (heure d’été d’Europe centrale)

gantt.autoSchedule()
undefined

gantt.getTaskByIndex(2)
{

start_date: Thu Aug 15 2019 00:00:00 GMT+0200 (heure d’été d’Europe centrale) {}
duration: 4
end_date: Mon Aug 19 2019 00:00:00 GMT+0200 (heure d’été d’Europe centrale) {}
constraint_type: “asap”

}

gantt.calculateEndDate(gantt.getTaskByIndex(2))
Wed Aug 21 2019 00: 00: 00 GMT + 0200(heure d’été d’Europe centrale)

What I don’t get is why after running gantt.autoschedule the datas stored are not the same as the one get by gantt.calculateEndDate ?

ok after exploring a little more the docs, I found this article # Changing Calendar Dynamically

you can define recalculation of all tasks on demand:

gantt.batchUpdate(function(){
  gantt.eachTask(function(task){
    task.start_date = gantt.getClosestWorkTime({
      dir: "future",
      date: task.start_date,
      unit: gantt.config.duration_unit,
      task: task
    });
    task.end_date = gantt.calculateEndDate(task);
    gantt.updateTask(task.id);
  });
});

So it seems that autoSchedule is only useful to reschedule linked tasks but there is no check about work time. Am i right ?

Hello Ouassim,
Thank you for reporting about that.
The autoscheduling feature is used to autoschedule tasks, not to calculate the work time.
I reproduced the behavior you describe:
http://snippet.dhtmlx.com/972bc4640
First, you can click on the left button, then click on the right button.
Task #2 wasn’t resized, Task #4 was resized. However, Task #3 is pushed correctly to its place as if Task #2 was resized.
Looks like, the autoscheduling doesn’t recalculate the task dates when it is not necessary to move the task. But there is no such issue if you manually move tasks: if a task stays in its place, nothing should have happened, if the task should be pushed, we need to recalculate the dates anyway. So, if you make the API call, you need to recalculate task dates manually as described in the article.

However, I added that as a bug so that Gantt will work the same way with and without the work time feature. I cannot give you any ETA, but I will notify you when the issue is fixed.