I obtained some information from the backend like [{end_date=2024-09-06 23:59:59, dur=7, parent=0, name=需求分析, id=1, resid=null, open=true,start_date=2024-08-31],but But On the right side, one day less in time,According to your statement, if it is from August 31st to September 6th, it should be set to September 7th, but according to the requirements, we need to set the end time to September 6th.How can I solve this problem?
Hello,
Gantt uses the non-inclusive duration. There is no way to change how Gantt works, but you can change what is displayed to the users by using the templates:
https://docs.dhtmlx.com/gantt/desktop__loading.html#taskenddatedisplayampinclusiveenddates
https://docs.dhtmlx.com/gantt/api__gantt_task_end_date_template.html
Here is an example of how it works:
https://snippet.dhtmlx.com/ici6m0dp
Also, you can set the duration_unit
to ‘hour’ and enable the work_time
parameter:
https://docs.dhtmlx.com/gantt/api__gantt_duration_unit_config.html
https://docs.dhtmlx.com/gantt/api__gantt_work_time_config.html
Gantt will show the same dates in the grid because the hours will be different.
To show the duration in days and even in fractional values, you can use the formatters:
https://docs.dhtmlx.com/gantt/desktop__formatters_ext.html#durationformatter
Here is an example with the date
input type in the inline editors:
https://snippet.dhtmlx.com/w5hrv69x
Here we need to modify the dates because the input
element with the date
type doesn’t have the hour values.
Here is another example with the datetime-local
input type in the inline editors:
https://snippet.dhtmlx.com/gjrgzm0p
The input element may take more space, but it will store the dates more accurately.