а

Include End Date in Day Calculation and Display in Chart


#1

Hi,

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?

Thanks


#2

Hello,
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


#3

Hello,
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.


#4

Hello,
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:
http://snippet.dhtmlx.com/a73af08c3

And you can try other workarounds:
http://snippet.dhtmlx.com/1c2df2d6a
https://snippet.dhtmlx.com/a464a8da2

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.


#5

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

Example:
(Before i link tasks)
image

(After i link tasks)
image

(After i refresh the page)
image

I try to use this code:

gantt.attachEvent("onAfterTaskUpdate", function (id, task) {
          gantt.refreshTask(id);
          gantt.render();
}

But without success.
Please help me. Thanks.


#6

Hello,
Unfortunately, I couldn’t reproduce the issue even if I add autoscheduling:
http://snippet.dhtmlx.com/0ecea6d42

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.