Hierarchy
-
WorkCalendar
- DefaultWorkCalendar
Properties
Readonly default
Flag that the calendar is being used as the default calendar.
Optional description
Description.
Readonly id
Unique identifier (uuid).
name
Name.
Methods
delete
-
Deletes the calendar.
Returns Promise<void>
getDays
-
Returns calendar days for the specified year.
Parameters
Returns Promise<readonly Readonly<WorkCalendarDay>[]>
-
Returns calendar days for the specified year.
Parameters
-
year: number
-
Optional startAt: TDate
Returns Promise<readonly Readonly<WorkCalendarDay>[]>
-
getSchedule
-
Get working schedule (cycle).
The business calendar by default can only have a weekly schedule. Example:
// get the 'defualt' business calendar const workCalendar = await System.productionSchedule.workCalendars.getDefault(); // fill out the weekly schedule (cycle) const workSchedule: WorkSchedule<'weekly'> = { type: 'weekly', cycle: [], }; for (let i = 1; i <= 7; i++ ) { const daySettings: CalendarDaySettings = { startAt: new TTime(9, 0, 0, 0), endAt: new TTime(18, 0, 0, 0), breaks: [ { startAt: new TTime(12, 0, 0, 0), endAt: new TTime(13, 0, 0, 0), description: 'Lunch break', }, ]; isWorkingDay: true, isHolidayDay: false, }; switch (i) { case 1: daySettings.description = 'Monday'; break; case 2: daySettings.description = 'Tuesday'; break; case 3: daySettings.description = 'Wednesday'; break; case 4: daySettings.description = 'Thursday'; break; case 5: daySettings.description = 'Friday'; break; case 6: daySettings.isWorkingDay = false; daySettings.isHolidayDay = false; daySettings.description = 'Saturday'; break; case 7: daySettings.isWorkingDay = false; daySettings.isHolidayDay = false; daySettings.description = 'Sunday'; break; } workSchedule.cycle.push(daySettings); } // apply the schdule to the calendar workCalendar.setSchedule(workSchedule); // save the business calendar await workCalendar.save();
Returns Readonly<WorkSchedule<"weekly">>
getSpecialCalendar
-
Get associated calendar of exception days.
Returns Promise<SpecialCalendar | undefined>
resetSpecialCalendar
-
Unbind the celandar of exeption days.
Returns void
save
-
Saves the changes made in the calendar.
Returns Promise<void>
setSchedule
-
Set working schedule (cycle).
Parameters
-
schedule: WorkSchedule<"weekly">
Returns void
-
setSpecialCalendar
-
Bind a calendar of exception days.
Parameters
-
calendar: SpecialCalendar
Returns void
-
Default business calendar