а

How to disable duration or set value for duration as float number?


#1

I can set value for start_date ex: 18-06-2019 00:00 and end_date ex: 20-06-2019 20:00

But when I drag and drop a task to start_date ex: 19-06-2019 00:00 and expected end_date must be 21-06-2019 20:00 but it is 21-06-2019 23:59.

I know It calculated by duration because the value of duration is always int number. I want to fix this.


#2

Hello Cao,
Gantt uses non-inclusive duration. Looks like, you apply the following workaround to make the duration inclusive:
http://snippet.dhtmlx.com/a73af08c3

Also, there is another thing. By default, tasks snap to the nearest scale border and Gantt rounds the duration because the duration parameter can only be an integer. You cannot set a float duration.
But you can change the duration_unit to hour and use the template in the column configuration to display the float duration in the grid:

	{name: "duration", label: "Duration", align: "center", width: 60, resize: true, template: function(task){
  		return task.duration / 24
  	}},

Also, you can add the following option, and the task won’t snap to the nearest scale border after moving or resizing the task:

gantt.config.round_dnd_dates = false;

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

Here is an example:
http://snippet.dhtmlx.com/e772c1071