Include End Date in Day Calculation and Display in Chart



I need to Calculate End Date Day and also display in chart. For Example :
Start Date : 01/12/2014
End Date : 15/12/2014
Exclude : saturday and sunday.
So it will display 10 days. (Exclude last day 15/12/2014).

I need to include last day 15/12/2014 in calculation.

How can I do that?



Currently there is no option for such mode. The dates are interpreted not inclusively, e.g. 20-05-2014 is interpreted as 00:00:00 20 May 2014 - which means task ends by 20 May, not including the day.

If you want to show dates inclusively, you can try to modify a date templates, in order to make them show end of the previous day
docs.dhtmlx.com/gantt/api__gantt … plate.html
Or manage the end date somehow during using the public events, e.g. docs.dhtmlx.com/gantt/api__gantt … event.html


I know the topic is a few years old, but I have the same problem, i need to include end date in calculation and display in chart.
I tried to use the example, but i couldn’t do it.
I have to show correct end_date on the gantt. In the lightbox i have a time field with start and end, and i need to show correctly. I have a resources gantt with hours. And i need to save the end_date on the db. how do i do it?
Thank you.


There is no built-in way to change how Gantt works.
There are various workarounds that you can use, but the easiest way would be to subtract 1 minute from the end_date of the task before updating it.
Here is the snippet that demonstrates how it works:

And you can try other workarounds:

And i need to save the end_date on the db. how do i do it?

Unfortunately, I don’t have a solution for the server-side. You need to implement a custom solution.


Hi. Thank you.
I did it, but I have a problem. When i link 2 tasks, the 2nd task get bug. When i refresh the page, everything is ok.
I have the same problem when i move a task

(Before i link tasks)

(After i link tasks)

(After i refresh the page)

I try to use this code:

gantt.attachEvent("onAfterTaskUpdate", function (id, task) {

But without success.
Please help me. Thanks.


Unfortunately, I couldn’t reproduce the issue even if I add autoscheduling:

Please, reproduce the issue in the snippet, then click on the “Share” button and send me the link.
Or send me an HTML file with all the necessary Javascript and CSS files.