checks whether the specified date is working or not
config | object | Date | either the configuration object of a time span or a specific date |
boolean | true, if the specified date is working time. Otherwise, false |
//checks whether the specified date is a working day in global settings
gantt.isWorkTime({ date: new Date(2023,3,5) });
// or
gantt.isWorkTime(new Date(2023,3,5));
//checks whether the specified date is working day for a specific task
gantt.isWorkTime({date: new Date(2023,3,5), task: task});
If the work_time option is disabled, the method always returns true
.
Let's assume that you set the following working time for the chart:
Then, if you check Monday April,3 2023 as in, you will get:
gantt.isWorkTime({date: new Date(2023,3,3,17,00), unit: "hour"});
//->false, cause 17:00-18:00 is not working time
gantt.isWorkTime({date: new Date(2023,3,3,17,00), unit: "day"});
//-> true, cause Monday is a working day
The configuration object can contain the following properties:
if (gantt.isWorkTime({date: date, task: task})){
alert("worktime of task" + task.text);
}