Skip to content

GetHoursInDay

Returns the number of hours the calendar includes on the specified date, such as the working hours of the day.

1
myCalendar.GetHoursInDay(date: DateTimeOffset):number

Parameters

DateTimeOffset date
    The target DateTimeOffset value.

Returns

The number of included hours on the date; 0 for a day the calendar excludes, such as a holiday.

Examples

Check whether the requested date is a working day

1
2
3
4
5
var hours = $Calendar.Get('Office').GetHoursInDay(DateTimeOffset.parse($Xml.Evaluate('RequestedDate')));

if (hours === 0) {
    throw new Error('The requested date is not a working day.');
}