Options
All
  • Public
  • Public/Protected
  • All
Menu

Module "lib/Engine/util/calendar_interval_parser/CalendarIntervalParser"

Index

References

ScheduleBuilder

Re-exports ScheduleBuilder

Type aliases

ArrayLookupFn

ArrayLookupFn: (value: number, values: number[], extent: number[]) => number | undefined

Array-lookup function signature used by the schedule compiler dispatch map.

Type declaration

    • (value: number, values: number[], extent: number[]): number | undefined
    • Parameters

      • value: number
      • values: number[]
      • extent: number[]

      Returns number | undefined

CompiledConstraint

CompiledConstraint: {}

A compiled constraint resolution engine produced by CalendarIntervalParser.compileConstraint.

Type declaration

CompiledSchedule

CompiledSchedule: { isValid: any; next: any; nextRange: any; prev: any; prevRange: any }

A compiled schedule with methods for enumerating occurrences.

Returned by CalendarIntervalParser.compile. All enumeration methods return 0 (the NEVER sentinel) when no valid occurrence exists within the search range.

Type declaration

  • isValid: function
    • isValid(d: Date): boolean
    • Check whether the given date satisfies the schedule constraints.

      Parameters

      • d: Date

        The date to check

      Returns boolean

      true if the date is a valid occurrence

  • next: function
    • next(count?: number, startDate?: Date, endDate?: Date): Date | Date[] | 0
    • Find the next occurrence(s) on or after startDate.

      Parameters

      • Optional count: number
      • Optional startDate: Date
      • Optional endDate: Date

      Returns Date | Date[] | 0

      A single Date when count is 1, an array when count > 1, or 0 if none found

  • nextRange: function
    • nextRange(count?: number, startDate?: Date, endDate?: Date): [Date, Date][] | 0
    • Find the next date range(s) where the schedule is valid, moving forward.

      Parameters

      • Optional count: number
      • Optional startDate: Date
      • Optional endDate: Date

      Returns [Date, Date][] | 0

      Array of [rangeStart, rangeEnd] tuples, or 0 if none found

  • prev: function
    • prev(count?: number, startDate?: Date, endDate?: Date): Date | Date[] | 0
    • Find the previous occurrence(s) on or before startDate.

      Parameters

      • Optional count: number
      • Optional startDate: Date
      • Optional endDate: Date

      Returns Date | Date[] | 0

      A single Date when count is 1, an array when count > 1, or 0 if none found

  • prevRange: function
    • prevRange(count?: number, startDate?: Date, endDate?: Date): [Date, Date][] | 0
    • Find the previous date range(s) where the schedule is valid, moving backward.

      Parameters

      • Optional count: number
      • Optional startDate: Date
      • Optional endDate: Date

      Returns [Date, Date][] | 0

      Array of [rangeStart, rangeEnd] tuples, or 0 if none found

ModifierFn

ModifierFn: (constraint: TimePeriod, values: number[]) => TimePeriod

Modifier function that wraps a TimePeriod to restrict it to a subset of its extent.

Type declaration

ModifierMap

ModifierMap: Record<string, ModifierFn>

Map of modifier functions keyed by name (after, before) and alias (a, b).

ScheduleConstraint

ScheduleConstraint: Record<string, number[]>

A single schedule constraint. Maps time-period keys to arrays of valid values.

Recognized keys:

  • t — time (seconds since midnight)
  • s — second (0–59)
  • m — minute (0–59)
  • h — hour (0–23)
  • D — day of month (1–31)
  • d / dw — day of week (1=Sun … 7=Sat)
  • dc — day-of-week count (1st Monday, etc.)
  • dy — day of year (1–366)
  • wm — week of month
  • wy — week of year (ISO)
  • M — month (1–12)
  • Y — year (1970–2099)
  • fd — full date (epoch ms)
  • fd_a — after full date (modifier)
  • fd_b — before full date (modifier)

ScheduleDate

ScheduleDate: Date

Alias kept for semantic clarity in schedule-engine signatures.

ScheduleDefinition

ScheduleDefinition: { error: number; exceptions: ScheduleConstraint[]; schedules: ScheduleConstraint[] }

A parsed schedule definition containing inclusion and exclusion constraints.

property

{ScheduleConstraint[]} schedules Array of inclusion constraints (OR'd together)

property

{ScheduleConstraint[]} exceptions Array of exclusion constraints

property

{Number} error Position of parse error in the input string, or -1 if parsing succeeded

Type declaration

TimePeriod

TimePeriod: { name: string; range: number }

A time-period object used by the schedule compiler. Each period (year, month, day, etc.) provides methods for value extraction, validation, extent computation, and navigation.

Type declaration

  • name: string
  • range: number

TimePeriodMap

TimePeriodMap: Record<string, TimePeriod>

Map of TimePeriod objects keyed by name and alias (e.g., year/Y, month/M).

Variables

Const NEVER

NEVER: 0 = 0

Sentinel value meaning "no valid occurrence".

Generated using TypeDoc