getClosestWorkTime

返回最近的工作时间

Date getClosestWorkTime(object config);
configobject配置对象或日期
Date表示最近工作时间的 Date 对象

Example

// 根据全局设置验证给定日期是否为工作日
gantt.getClosestWorkTime({date:new Date(2019,04,26)});
// 或者
gantt.getClosestWorkTime(new Date(2019,04,26));
 
// 验证给定日期是否为特定任务的工作日
gantt.getClosestWorkTime({ date: new Date(2019,04,26), task:task });

Details

如果 work_time 选项被禁用,该方法将返回原始日期,不做任何更改。

配置对象属性

配置对象可以包含以下属性:

属性 描述
date 请求最近工作时间的日期
gantt.getClosestWorkTime({
    date:new Date(2019,04,26),
    dir:"future"
});
// -> 如果 duration_unit="day",则返回 Mon May 27 2019 00:00:00
// -> 如果 duration_unit="hour",则返回 Mon May 27 2019 08:00:00
dir ('future''past') 指定查找最近时间的方向
gantt.getClosestWorkTime({
    date:new Date(2019,04,18),
    dir:"past"
});
// -> 返回 Sat May 18 2019 00:00:00
unit 用于定位最近工作时间的时间单位
// 查找最近的工作小时
gantt.getClosestWorkTime({
    date:new Date(2019,04,18), 
    dir:"future", 
    unit:"hour"
});
// -> 返回 Mon May 20 2019 08:00:00
task 可选,用于计算持续时间的任务对象
var closestTime = gantt.getClosestWorkTime({
    date:date, 
    task:task
});
See also
Back to top