Hierarchy

  • BaseWorkCalendar
    • DefaultWorkCalendar

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

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).

    By default, the business calendar can only have a weekly work schedule.
    Example:

    // Get the default business calendar 
    const workCalendar =  await System.productionSchedule.workCalendars.getDefault(); 
    // Fill out the  weekly work schedule (loop) 
    const workSchedule: WorkSchedule<'weekly'> = {  
        type: 'weekly', 
        cycle: [ 
            { 
                isWorkingDay:  false, 
                description: 'Sunday' 
            }, 
            {  
                useDefault: true, 
                description: 'Monday' 
            } , 
            { 
                useDefault: true, 
                description:  'Tuesday' 
            }, 
            { 
                useDefault: true, 
                 description: 'Wednesday' 
            }, 
            { 
                useDefault:  true, 
                description: 'Thursday' 
            }, 
            {  
                useDefault: true, 
                description: 'Friday' 
            } , 
            { 
                isWorkingDay: false, 
                description:  'Saturday' 
            }, 
        ], 
        defaultDaySettings: { 
            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, 
        }, 
    }; 
    // Apply the work schedule to the  calendar 
    workCalendar.setSchedule(workSchedule); 
    // Save the business  calendar 
    await workCalendar.save(); 
    

    Returns Readonly<WorkSchedule<"weekly", CalendarScheduleDaySettings>>

getSpecialCalendar

  • Get associated calendar of exception days.

    Returns Promise<SpecialCalendar | undefined>

resetSpecialCalendar

  • resetSpecialCalendar(): void
  • Unbind the celandar of exeption days.

    Returns void

save

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

    Returns Promise<void>

setSchedule

  • Set working schedule (cycle).

    Parameters

    Returns void

setSpecialCalendar

  • Bind a calendar of exception days.

    Parameters

    Returns void