Set the time_step for a specific task

I have a task with dates in the “date” format. The “date” format assumes that the date value does not contain a timestamp.

I also have a task with dates that do contain a timestamp.
I need to output these two tasks simultaneously. To solve this problem, dates without a timestamp are output with the default time value:
start date - YYYY-mm-dd 00:00;
end date - YYYY-mm-dd 23:59.

When dragging and dropping such tasks, the “time_step” for the task without a timestamp must be set to “day.” For tasks with a timestamp, a “time_step” value of “minute” is used. Is it possible to implement a “time_step” setting individually for each task?

It would be desirable to also ensure that the autoscheduling calculation is performed correctly. That is, Task 1 2025-05-01 14:00:00 - 2025-05-10 14:00:00
Task 2 2025-05-10 - 2025-05-12
I establish a “Finish-Start” relationship with a lag of 2 days from task 1 to task 2.
I expect the start date of task 2 after autoscheduling to be calculated as 2025-05-13 00:00

Hello Petr,
Unfortunately, there is no way to make the time_step config to work differently for different tasks. You need to implement a custom solution by using the Gantt API and Javascript.

First of all, the value of the time step is specified in minutes:
https://docs.dhtmlx.com/gantt/api__gantt_time_step_config.html#:~:text=task's%20time%20values-,number,-time_step%3B

By default, when you drag the tasks, Gantt snaps them to the start of the timeline cell. If you disable the round_dnd_dates config, Gantt will snap the dragged tasks to the start of the nearest hour. And if you set 1, Gantt will snap it to the nearest minute:
https://snippet.dhtmlx.com/bd7ir3w7

If you want to snap some tasks to the start of the day and other tasks to the start of the minute, you can set the time_step config to 1, then round the task dates manually with the roundDate method in the onAfterTaskDrag event handler:
https://docs.dhtmlx.com/gantt/api__gantt_rounddate.html

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

Here is an example of how it can be implemented:
https://snippet.dhtmlx.com/ywupk1rr

The way you want it to work with auto-scheduling contradicts with how Gantt calculates the dates when auto-scheduling tasks. The 2025-05-10 date for Gantt means 2025-05-10 00:00. So, without the lag parameter, you want the successor task (Task 2) to start earlier than its predecessor ends:
Task 1 2025-05-01 14:00:00 - 2025-05-10 14:00:00
Task 2 2025-05-10 00:00:00 - 2025-05-12 00:00:00

Gantt won’t work that way, and it is not related to the time_step parameter. Also, if it worked the way you suggest, Gantt would make it this way:
Task 1 2025-05-01 14:00:00 - 2025-05-10 14:00:00
Task 2 2025-05-11 00:00:00 - 2025-05-13 00:00:00

It is because the end date of the predecessor task ends after 12:00, so the rounded date should be the next day.

So, it is not supposed to work that way in Gantt. In theory, it should be possible to implement that if you use the "hour" value for the duration_unit parameter. But you need to implement a custom logic to set the lag value for the links. And there are no ready examples of the implementation.

Hello!

Thanks for your reply. The solution to round dates when dragging was helpful.

P.S. Regarding autoscheduling, I just described a behavior that satisfies the current logic.
Input data:
Task 1: 2025-05-01 14:00:00 - 2025-05-10 10:00:00
Task 2: 2025-05-10 - 2025-05-12
Link: task 1 - task 2; End-to-Start; Lag 2 days

After autoscheduling is triggered:
Task 1: 2025-05-01 14:00:00 - 2025-05-10 14:00:00
Task 2: 2025-05-13 - 2025-05-15
Actual lag value: 2 days 14 hours, which satisfies the lag limit