본문으로 건너뛰기

isWorkTime

Description

지정된 날짜가 근무 시간인지 여부를 확인합니다

isWorkTime: Calendar['isWorkTime']

Parameters

  • config - (required) object | Date - 타임 스팬의 구성 객체 또는 특정 날짜

Returns

  • isWorkTime - (boolean) - true, 지정된 날짜가 근무 시간인 경우. 그렇지 않으면 false

Example

//전역 설정에서 지정된 날짜가 근무일인지 확인합니다
gantt.isWorkTime({ date: new Date(2023,3,5) });
// 또는
gantt.isWorkTime(new Date(2023,3,5));

//특정 작업에 대해 지정된 날짜가 근무일인지 확인합니다
gantt.isWorkTime({date: new Date(2023,3,5), task: task});

Details

노트

If the work_time option is disabled, the method always returns true.

다음과 같은 차트의 근무 시간을 설정했다고 가정해 봅시다:

  • 근무일: 월요일 - 금요일
  • 근무 시간: 6:00 - 15:00

그렇다면, 2023년 4월 3일 월요일을 아래와 같이 확인하면:

gantt.isWorkTime({date: new Date(2023,3,3,17,00), unit: "hour"}); 
//->false, 17:00-18:00은 근무 시간이 아닙니다

gantt.isWorkTime({date: new Date(2023,3,3,17,00), unit: "day"});
//-> true, 월요일은 근무일이므로

Configuration object properties

구성 객체에는 다음 속성들이 포함될 수 있습니다:

  • date - (Date) 확인할 날짜
    • unit - (string) 선택적, 시간 단위: "minute", "hour", "day", "week", "month", "year"
    • task - (object) 선택적, 기간을 계산할 작업의 객체
if (gantt.isWorkTime({date: date, task: task})){
alert("worktime of task" + task.text);
}
Need help?
Got a question about the documentation? Reach out to our technical support team for help and guidance. For custom component solutions, visit the Services page.