а

Can I change the task timeline ?


#1

For example,the start date is 2019-4-1 ,end date is 2019-4-3,
I want change the timeline ,make it draw from 2019-4-1 to 2019-4-3, not 2019-4-2
how can I do?


#2

If you want to change the time scale, what I do is I do it in the background, one day later.


#3

If you don’t understand, use the netease youdao dictionary


#4

Hi @xcchsm !

If you want to set start and end dates, you need to use gantt.config.start_date and gantt.config.end_date:

https://docs.dhtmlx.com/gantt/api__gantt_start_date_config.html

https://docs.dhtmlx.com/gantt/api__gantt_end_date_config.html

Here is the example can help to you

gantt.config.start_date = new Date(2019, 04, 01);

gantt.config.end_date = new Date(2019, 04, 03);

Also you can change the displayed range dynamically. Look here:

https://docs.dhtmlx.com/gantt/desktop__configuring_time_scale.html#dynamic_scale


#5

Hi,I mean the task line%E5%BE%AE%E4%BF%A1%E6%88%AA%E5%9B%BE_20190415091742

the end_date is 2018-4-1, I want change the task line , add one day.


#7

Hi @xcchsm!

In this case 2018-4-1 displayed in the grid means 2018-04-01 00:00:00 - meaning that the tasks spans whole 31st of March, and ends by the 1st of April.
I understand why this is confusing, but currently there is no good way to switch the display logic of end dates

As a simple workaround, you can subtract one minute from the end_date of each of your tasks, that way you’ll task would end at 2018-03-31 23:59:00 and will be shown in gantt as expected.
It can be done by using gantt.date.add() metod with onBeforeTaskUpdate event.
https://docs.dhtmlx.com/gantt/desktop__date_operations.html#addingsubtractingatimeintervaltofromadate
https://docs.dhtmlx.com/gantt/api__gantt_onbeforetaskupdate_event.html
Here is the sample with changed tasks’ timeline:
http://snippet.dhtmlx.com/9402e4382