TimelineKit API
    Preparing search index...

    Class WorkingCalendar

    Defines working days, shifts, and holidays for scheduling calculations.

    Index

    Constructors

    Properties

    defaultLengthUnit: LengthUnit = 'day'

    Default unit for new task durations.

    nationalHolidays: Date[]

    Dates that are non-working regardless of the day of the week.

    shifts: WorkingShift[]

    Working time ranges within each working day.

    startOfWeek: DayOfWeek

    First day of the week for calendar display.

    workingDays: DayOfWeek[]

    Days of the week that are working days.

    Methods

    • Add (or subtract) working hours to a date, skipping non-working time.

      Parameters

      • current: Date
      • hours: number
      • OptionalmoveToNextIfHoursZero: boolean

      Returns Date

    • Get the end time of the last shift on a working day (moves forward to the next working day if needed).

      Parameters

      • current: Date

      Returns Date

    • Calculate working hours between two dates, respecting shifts and non-working days.

      Parameters

      • time1: Date
      • time2: Date

      Returns number

    • Get the start of the week containing the given date.

      Parameters

      • current: Date

      Returns Date

    • Check whether a time matches the end of the last working shift.

      Parameters

      • current: Date

      Returns boolean

    • Check whether a date falls on a working day (not a holiday or non-working day).

      Parameters

      • current: Date

      Returns boolean

    • Move a date backward to the end of the nearest working shift.

      Parameters

      • current: Date
      • keepTimeIfInsideShift: boolean

      Returns Date

    • Move a date forward to the start of the nearest working shift.

      Parameters

      • current: Date
      • keepTimeIfInsideShift: boolean

      Returns Date