End date point precision issue

For example,I set end_date is 2022-11-24 23:59:59,but the end point looks like 2022-11-24 00:00:00,search the doc,i don’t find any way to fix it.So, how can I set the config?THX.

Hello,
If you load a task with the specified start_date and end_date parameters, it should have these dates:
https://snippet.dhtmlx.com/w0g004iu

The minimal scale and duration_unit in DHTMLX Gantt is minute:
https://docs.dhtmlx.com/gantt/api__gantt_duration_unit_config.html

So, if you drag a task, its dates will be rounded.

You will need to implement a custom scale and duration_unit if you want to have the second scale:
http://snippet.dhtmlx.com/5/e7bb6d443

If you don’t want to round the dates with the custom second unit, you need to store the task dates in a variable, then restore them in the onAfterTaskDrag event handler:
https://snippet.dhtmlx.com/y9x52cki

Also, you need to know that Gantt uses non-inclusive end_date/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:
http://snippet.dhtmlx.com/5/2fc90812a

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:
http://snippet.dhtmlx.com/5/1b2d12c95

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:
http://snippet.dhtmlx.com/5/c4f4b19aa

The input element may take more space, but it will store the dates more accurately.

Hello ramil, with the help of this topic, I have a question to ask, that is, in the task data transmitted from my backend to the frontend, the start time and end time have been given and the duration has been given, but when rendering in gantt, the duration will be inexplicable one day less
image
As shown in the figure, my start time is 11/01/8:00 and my end time is 11/30/16:00. My calendar is set for 8:00~16:00 from Monday to Sunday,According to the calendar, my deadline should be 30 days, but it turned out to be one day short.
Looking forward to your reply, thank you

Hello,
I suppose you use the “day” duration_unit. In this case, the duration is calculated in days, and Gantt will round the duration to the days if the hours are specified.
I added a simple dataset into the following snippet:
https://snippet.dhtmlx.com/j2v5swp4

You can use the “hour” duration_unit with the formatter extension:
https://docs.dhtmlx.com/gantt/api__gantt_duration_unit_config.html
https://docs.dhtmlx.com/gantt/desktop__formatters_ext.html#durationformatter
This will allow you to store the duration in hours but show it in days in Gantt.
Here is an example:
https://snippet.dhtmlx.com/m56u9ver

If you specify the start_date and end_date parameters, the duration parameter is ignored and calculated depending on the date parameters:
https://docs.dhtmlx.com/gantt/desktop__loading.html#loadingtaskdates

So if you save the dates in the inclusive format on the server, and use the “day” duration_unit, you need to convert the dates to the non-inclusive format before loading them into Gantt. Then you need to convert them back when saving the changes on the server.

But as you can see, with the “hour” duration_unit it is working better.