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 … plate.html
Or manage the end date somehow during using the public events, e.g. … 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.



I know the topic is a few years old, but I have the same problem. I used a solution by ramil and it works great except for milestones.
I have the following examples, where you can see that now the end_date is before start_date, which is not ok:

I tried to make another check for duration, but than milestones on edges does not match with parent dates:

Is there any good workaround for this?



Hello Marko,
For milestones, you can use the template function in the column configuration where you can return any data or HTML elements:
You can return an empty string or the actual end_date.
By default, you cannot set the end_date via the lightbox, but you can do that with the inline editors. As milestones ignore the end_date parameter, there is no point to allow users to try to set that value. So, you can return false in the onBeforeEditStart event handler for milestone tasks:
Here is an example of how it might be implemented:


Hi ramil, thank you for your answer.

Unfortunately your solution does not solve my problem completely. If I put milestone at the end, than parent task end date should be equal to milestone start date (but in gantt there comes to one day lack). I prepared an image comparing Project and DHTMLX and I wonder if there is there a chance to match those gantt grids to look same?

Here is an example from the image:



Hello Marko,
Thank you for the clarification.
It works that way because the milestone actually starts 04 April, but its duration is 0.
It seems that there is no easy solution for that.

I would suggest adding a custom task type that will look like a milestone, but it can behave like a regular task with any duration.
Here is an example: