Hierarchy

Properties

Readonly default

default: true

Flag that the calendar is being used as the default calendar.

Optional description

description: undefined | string

Description.

Readonly id

id: string

Unique identifier (uuid).

name

name: string

Name.

Methods

delete

  • delete(): Promise<void>
  • Deletes the calendar.

    Returns Promise<void>

getDays

  • getDays(from: TDate, to: TDate, startAt?: TDate): Promise<readonly Readonly<WorkCalendarDay>[]>
  • getDays(year: number, startAt?: TDate): Promise<readonly Readonly<WorkCalendarDay>[]>
  • 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

resetSpecialCalendar

  • resetSpecialCalendar(): void

save

  • save(): Promise<void>
  • Saves the changes made in the calendar.

    Returns Promise<void>

setSchedule

setSpecialCalendar