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
- Schedule
- new Schedule(definition)
- instance
- .isHoliday(date) ⇒
boolean
- .isWorkingDay(date) ⇒
boolean
- .isHoliday(date) ⇒
- static
new Schedule(definition)
Creates a Schedule class.
Param | Type |
---|---|
definition | object |
schedule.isHoliday(date) ⇒ boolean
Check if, according to the schedule, the date provide is a holiday
Kind: instance method of Schedule
Param | Type |
---|---|
date | Date |
Example
const schedule = new Schedule({ definition });
const myDate = new Date();
const isHoliday = schedule.isHoliday(myDate);
schedule.isWorkingDay(date) ⇒ boolean
Kind: instance method of Schedule
Param | Type |
---|---|
date | Date |
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.
Param | Type |
---|---|
userUid | string |
Example
const schedule = await Schedule.getScheduleForUser("user_uid");