Schedule

Schedule

Schedules allow you to perform logical operations based on a system or user schedule. This is especially useful when working with timezones, or when you’re trying to trigger logic that depends on working days or holidays

Kind: global class

new Schedule(definition)

Creates a Schedule class.

ParamType
definitionobject

schedule.isHoliday(date) ⇒ boolean

Check if, according to the schedule, the date provide is a holiday

Kind: instance method of Schedule

ParamType
dateDate

Example

const schedule = new Schedule({ definition });
const myDate = new Date();
const isHoliday = schedule.isHoliday(myDate);

schedule.isWorkingDay(date) ⇒ boolean

Kind: instance method of Schedule

ParamType
dateDate

Schedule.getScheduleForUser(userUid) ⇒ Promise.<Schedule>

Initialize a Schedule object based on the schedule of the provided user.

Kind: static method of Schedule
Returns: Promise.<Schedule> - an instance of the Schedule class.

ParamType
userUidstring

Example

const schedule = await Schedule.getScheduleForUser("user_uid");