Incorrect start date with dependencies

I’m running into a problem where the start date is being incorrectly calculated when there are multiple dependencies in a chain.

If I have two tasks with dependency between them (finish-to-start), and I move the predecessor, the child is moved correctly. If I move it such that the ancestor would start on a Saturday, it also correctly moves the task to the Monday instead.

If I introduce a third task as a top level predecessor, and then move that, it changes. Instead of the furthest ancestor having its start date changed to the Monday, it incorrectly sets the start date to the Saturday, however it does change the end date to be the Tuesday and does correctly set the duration to 1.

If I call gantt.autoSchedule(task_id) then it does recalculate the date correctly, but only if I run this on the immediate predecessor of the task with invalid tasks. It does not work anywhere else in the dependency tree.


Please create a demo with links and other configs you have set in your application, where the problem can be reproduced.

Hi Polina,

is there a public link to the pro version of the gantt extensions? I’ve produced a snippet, but the issue that I’m facing is with the autoscheduler which is a pro feature, and I cant get the source of it onto the snippet. I can paste the copy that I’ve got into the snippet source if that’s allowed?

Unfortunately no.
May be you can provide with access to your application or attach files, so that we can reproduce locally. Or just send a prepared snippet with code and we will reproduce using it.

I’ve attached a basic HTML page. It’s currently referencing the following files in the same directory:

  • dhtmlxgantt.js
  • dhtmlxgantt_auto_scheduling.js
  • dhtmlxgantt.css

We’re using version 4.1.0 of the gantt library.

When it loads, there are 3 tasks with dependencies between them. If you move ‘Task 1’ to the 5th of January, I would expect to see ‘Task 3’ get moved to the 9th of January, however it simply gets moved to the 7th (a Saturday). If you then run gantt.autoSchedule(2) in a console, it is corrected and renders as expected. (1.09 KB)

Thank you for the attached file.

To solve it, you need to redefine default gantt._autoSchedulingDateResolver.getConstraintDate function in the next way:

[code]gantt._autoSchedulingDateResolver.getConstraintDate = function(relation, getEndDate){
var new_start = getEndDate(relation.source);

if(new_start && relation.lag && relation.lag1 == relation.lag){
new_start = gantt.calculateEndDate(new_start, relation.lag

if(!gantt.isWorkTime(new Date(new_start))){
new_start =, 2, ‘day’);

return new_start;
Please, check the demo here:

ah perfect thanks! Seems to be working correctly now :slight_smile: