CalendarApi
Calendar, holiday and working-day helpers.
Working days are derived from calendarOptions: a day is working when it is
not a configured weekend day and not a configured holiday.
export interfaceMethods
| Method | Returns | Description |
|---|---|---|
| getNextWorkingDay(from) | Date | Returns the next working day after from (defaults to today).Never returns from itself. |
| getPreviousWorkingDay(from) | Date | Returns the previous working day before from (defaults to today).Never returns from itself. |
| getWeekStartsOn() | number | First day of the week for week-number / start-of-week Expression Functions ( calendarOptions.weekStartsOn, default 0 = Sunday). |
| isHoliday(dateToCheck) | boolean | True when the date is in the configured holiday list. Weekends are not holidays unless also listed in calendarOptions.holidays. |
| isSameDay(date1, date2) | boolean | Returns true if both dates are the same calendar day (time ignored). |
| isToday(dateToCheck) | boolean | Returns true if the given date is today |
| isTomorrow(dateToCheck) | boolean | Returns true if the given date is tomorrow |
| isWeekend(dateToCheck) | boolean | True when the date falls on a configured weekend day ( calendarOptions.weekendDays, default Saturday/Sunday). |
| isWorkingDay(dateToCheck) | boolean | True when the date is neither a weekend day nor a configured holiday. |
| isYesterday(dateToCheck) | boolean | Returns true if the given date is yesterday |
Method Details
getNextWorkingDay
Returns the next working day after from (defaults to today).
Never returns from itself.
getNextWorkingDay(from?: Date): Date;Parameters
| Parameter | Type | Description |
|---|---|---|
| from | Date | Optional start date (defaults to today) |
Returns
The next working day after from (defaults to today). Never returns from itself
Date
getPreviousWorkingDay
Returns the previous working day before from (defaults to today).
Never returns from itself.
getPreviousWorkingDay(from?: Date): Date;Parameters
| Parameter | Type | Description |
|---|---|---|
| from | Date | Optional start date (defaults to today) |
Returns
The previous working day before from (defaults to today). Never returns from itself
Date
getWeekStartsOn
First day of the week for week-number / start-of-week Expression Functions
(calendarOptions.weekStartsOn, default 0 = Sunday).
getWeekStartsOn(): number;Returns
First day of the week for week-number / start-of-week Expression Functions (calendarOptions.weekStartsOn, default 0 = Sunday)
number
isHoliday
True when the date is in the configured holiday list.
Weekends are not holidays unless also listed in calendarOptions.holidays.
isHoliday(dateToCheck: Date): boolean;Parameters
| Parameter | Type | Description |
|---|---|---|
| dateToCheck | Date | Date to check |
Returns
True when the date is in the configured holiday list. Weekends are not holidays unless also listed in calendarOptions.holidays
boolean
isSameDay
Returns true if both dates are the same calendar day (time ignored).
isSameDay(date1: Date, date2: Date): boolean;Parameters
| Parameter | Type | Description |
|---|---|---|
| date1 | Date | 1st Date |
| date2 | Date | 2nd Date |
Returns
true when both dates are the same calendar day (time ignored)
boolean
isToday
Returns true if the given date is today
isToday(dateToCheck: Date): boolean;Parameters
| Parameter | Type | Description |
|---|---|---|
| dateToCheck | Date | Date to Check |
Returns
true when the given date is today
boolean
isTomorrow
Returns true if the given date is tomorrow
isTomorrow(dateToCheck: Date): boolean;Parameters
| Parameter | Type | Description |
|---|---|---|
| dateToCheck | Date | Date to Check |
Returns
true when the given date is tomorrow
boolean
isWeekend
True when the date falls on a configured weekend day
(calendarOptions.weekendDays, default Saturday/Sunday).
isWeekend(dateToCheck: Date): boolean;Parameters
| Parameter | Type | Description |
|---|---|---|
| dateToCheck | Date | Date to check |
Returns
True when the date falls on a configured weekend day (calendarOptions.weekendDays, default Saturday/Sunday)
boolean
isWorkingDay
True when the date is neither a weekend day nor a configured holiday.
isWorkingDay(dateToCheck: Date): boolean;Parameters
| Parameter | Type | Description |
|---|---|---|
| dateToCheck | Date | Date to check |
Returns
True when the date is neither a weekend day nor a configured holiday
boolean
isYesterday
Returns true if the given date is yesterday
isYesterday(dateToCheck: Date): boolean;Parameters
| Parameter | Type | Description |
|---|---|---|
| dateToCheck | Date | Date to Check |
Returns
true when the given date is yesterday
boolean