How to adjust start_date, end_date and duration

Hi all,

I let gantt parse data with start_date and end_date like below,
start_date: Feb 19th 2018
end_date: Feb 23rd 2018
and those 2 dates are shown on the grid columns.

Then, gantt calculates the duration as 4days automatically and draw a task bar from Feb 19th to Feb 22nd.
However, I want gantt to draw the bar from Feb 19th to Feb 23rd and to calculate the duration as 5days.
I want gantt to include the end_date when calculating the duration. It excludes it.

Feb 19th: 1 day
Feb 20th: 1 day
Feb 21st: 1 day
Feb 22nd: 1 day
Feb 23rd: 1 day

total 5 days

and lightox’s time control, too. When I pick up a date on lightbox, for example,
start_date: Feb 19th duration +1, then end_date should be Feb 19th, not Feb 20th.
How can I do this?

Thank you,

Hi,

In your case end_date is 23-02-2018. So it means that your event finishes Feb 23rd at 00:00 and covers Feb 22th and don’t cover Feb 23rd. If you want to fully cover Feb 23rd you should set end date “24-02-2018” or “24-02-2018 00:00”. Maybe you could at least use “23-02-2018 23:59:59”, but correct case is to use “24-02-2018” or “24-02-2018 00:00”.
If it necessary for you, you could correct event dates in onTaskLoading handler.
(docs.dhtmlx.com/gantt/api__gant … event.html)

Hi Polina,

Thank you for your reply.

Actually, I use “onTaskLoading” handler not “onEventLoading”, but “onTaskLoading” is working perfectly!
I need to cover Feb 23rd and have to show the date "Feb 23rd (I shouldn’t show “Feb 24th” anywhere on the gantt) as the end date, so I ended up with “23-02-2018 23:59:59”.

Yes, you need to use onTaskLoading in Gantt. I’m a little confused, onEventLoading for DHTMLX Scheduler.