Resource working time with dates and hours

Hi,

I’m trying to set the working times of resources based on multiple combinations of dates and hours.

I would like to do something like this:
var testCal = gantt.addCalendar({
worktime: {
dates: [new Date(2019, 4, 13), [6, 22]]
}
});

This would set the 13th of May between 06:00 and 22:00 as working time.

Does anyone know if this is possible with dhtmlx?

Hello,
Yes, it is possible to do that.
First, you need to create the calendar:

gantt.addCalendar({
    id:"custom"
});

Then you can use the setWorkTime method to specify the date and an array with hours:

gantt.getCalendar("custom").setWorkTime({
  date:new Date(2018,03,02), 
  hours:[01,02,04,06,08,14]
});

You can read more about that method in the following article:
https://docs.dhtmlx.com/gantt/api__gantt_setworktime.html
Here is an example of how it might be implemented:
https://snippet.dhtmlx.com/56c974063

Hey Ramil,

Thx for the hint. I’ll try it out soon!