Type parameters

Hierarchy

  • WorkSchedule

Properties

cycle

cycle: D[]

Working cycle.

A cycle is a structured list of day settings that is applied to each calendar day in a loop, starting with the date that this work schedule is introduced. The weekly cycle is an array of seven elements that store the settings of each day of the week. The element with the 0 index is Sunday, with the 1 index, Monday, etc. Example of configuring a work schedule with a weekly cycle for a five-day work week.

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), // Work  starts at 9:00 am 
        endAt: new TTime(18, 0, 0, 0),  // Work ends at 6: 00 pm 
        breaks: [ // During the day, there is one break from 12:00 pm  to 1:00 pm 
            { 
                startAt: new TTime(12, 0, 0, 0),  
                endAt: new TTime(13, 0, 0, 0), 
                description:  'Lunch break', 
            }, 
        ]; 
        isWorkingDay: true,  //  It is a working day 
        isHolidayDay: false, // Is not a holiday 
    }  
}; 

An arbitrary cycle can be an array of any number of elements. The element with the 0 index will contain settings for the day that the work schedule is introduced. This type of cycle can be used, for example, to set up a work schedule with shifts lasting for one whole day with two days off between them. Example of a work schedule with one-day shifts and two days off. Work starts at 7:00 am and ends at 6:59 am of the next calendar day.

const workSchedule: WorkSchedule<'custom'> = {
    type: 'custom',  
    cycle: [], 
}; 
// A shift lasts for 24 hours (with a break that lasts  for half an hour). It spreads over two calendar days 
workSchedule.cycle. push({ 
    startAt: new TTime(7, 0, 0, 0),    // Work starts at 7:00 am  
    endAt: new TTime(23, 59, 59, 999), // Work ends at 11:59 pm 
    breaks:  [ // There is one break for half an hour from 3:00 pm to 3:30 pm 
        {  
            startAt: new TTime(15, 0, 0, 0), 
            endAt: new TTime( 15, 30, 0, 0), 
        }, 
    ], 
    isWorkingDay: true,  // Is a working  day 
    isHolidayDay: false, // Is not a holiday 
}); 
workSchedule.cycle. push({ 
    startAt: new TTime(0, 0, 0, 0),   // Work starts at 12:00 am  
    endAt: new TTime(6, 59, 59, 999), // Work ends at 06:59 am 
     isWorkingDay: true,  // Is a working day 
    isHolidayDay: false, // Is not  a holiday 
}); 
// Settings of a day off 
workSchedule.cycle.push({ 
     startAt: new TTime(0, 0, 0, 0),    // A day off starts at 12:00 am 
     endAt: new TTime(23, 59, 59, 999), // A day off ends at 11:59 pm 
     isWorkingDay: false, // Is not a working day 
    isHolidayDay: false, // Is  not a holiday 
}); 

Optional defaultDaySettings

defaultDaySettings: CalendarDaySettings

Standard working day settings.

The field is used to configure the settings of a regular working day. The fiels is created with the following default settings:

{
      startAt: new TTime(9, 0, 0, 0),    // Working day starts at 9:00 
     endAt:  new TTime(18, 0, 0, 0), // Working day ends at 18:00 
     breaks: [ //  During the working day there is one break from 12:00 to 13:00 
         {  
             startAt: new TTime(12, 0, 0, 0), 
             endAt: new  TTime(13, 30, 0, 0), 
         }, 
     ], 
     isWorkingDay: true,  //  This is a work day 
     isHolidayDay: false, // This is not a non-working  day 
} 

Note: The field is always filled in. This field is a non- required one for reverse compatibility.

type

type: T

Type of work schedule: weekly — weekly, custom — custom.