[Solved] Bug with duration in gantt?

Console logging the data being parsed shows the duration to be correct i.e 53 hours but when it is shown on the gantt chart, it is randomly transformed to 46 hours. Even more surprising is that when I console log that specific task in a gantt.config.column template, it has already been transformed to 46 hours there as well. Yet in the network tab and the console and in server logs, the calendar should be parsing that task’s duration as 53 hours.

Most mindboggling is the fact that the lightbox is configured to show start and end times and if you calculate the hours between the start and end times displayed in the lightbox you get 53 hours! And yet the duration displayed in the duration column is 46 hours. I am at my wit’s end with this error and it seems to be a bug with the gantt chart. The error isn’t just with one task by the way, it’s with all of them. The bigger the duration of the task, the worse it is. I have attached a screen shot of the lightbox date not matching the duration column.

Also I am not using any connectors but I am generating data myself and just parsing it to the calendar via a servlet. I am using gantt pro.


Seems like you have set work time.
docs.dhtmlx.com/gantt/desktop__ … _time.html

For example, in the sample task 1 has duration=5, but lasts from 3 Apr to 10 Apr (7 days). Sat and Sun are non working days and isn’t included in the working hours.
docs.dhtmlx.com/gantt/samples/0 … ktime.html

Hi Polina,

But in the sample you sent, the duration shown in the column on the left always stays the same i.e 5. It’s the length of the task bar that changes. That’s not the problem I am having. The duration shown in the left in my chart is completely wrong (46) while the task bar length is right (53). The duration when I log the task out into the console is also wrong.

In any case, I tried setting work time off:

gantt.config.work_time = false;

gantt.skip_off_time = false;

and it still didn’t solve the problem.

Any other ideas?

Please, create a demo, where we can reproduce the issue to understand the cause of it.

Hi again Polina,

I have made a snippet here:


I included only parts that are relevant for this bug so some functions might not work. You can see durations being different between the parsed data and data shown on the chart

Hey, is it possible to get help with this problem or not? I have submitted a snippet like you asked.


Sorry for delay.
To fix this problem, you need to specify work_time instead of setting work time off:
gantt.setWorkTime({ hours:[0,24] });

As for ‘Task B’, it has duration=25 in data. But it starts at 09:11 and lasts from 15 May 10:00 to 16 May 10:00 (full hours) + has part 9-10.00 15May and 10-11.00 16May. It is 26 hours. To have 25 hours in the column in grid, the task should start at 9.00.

Thank you! That fixed it.