Options
All
  • Public
  • Public/Protected
  • All
Menu

Internal helpers used by CompiledConstraintImpl and CompiledScheduleImpl at runtime. Pure static utilities kept separate from CalendarIntervalParser so the parser class stays focused on its public API surface.

module

Engine/util/calendar_interval_parser/IntervalParseHelpers

internal

Hierarchy

  • IntervalParseHelpers

Index

Methods

Static cleanDate

  • cleanDate(date: Date): Date | undefined
  • Defensive clone. Applied to every result before it leaves the engine so callers that mutate returned Dates cannot corrupt cached schedule state.

    Parameters

    • date: Date

    Returns Date | undefined

Static compareFn

  • compareFn(dir: string): (a: any, b: any) => boolean
  • Direction-aware date comparator. Returns a binary comparator whose polarity depends on dir: for "next" it answers "is a after b?", for "prev" it flips to "is b after a?". Lets the iteration engine run one loop body for both directions.

    Parameters

    • dir: string

    Returns (a: any, b: any) => boolean

      • (a: any, b: any): boolean
      • Parameters

        • a: any
        • b: any

        Returns boolean

Static sortArray

  • sortArray(arr: number[], zeroIsLast?: boolean): void
  • Sort in place, ascending. When zeroIsLast is set, a leading 0 is moved to the end which the parser encodes "the maximum extent" as 0 for some periods (e.g. day-of-month 31 or 0 depending on whether last was applied).

    Parameters

    • arr: number[]
    • Optional zeroIsLast: boolean

    Returns void

Static tickStarts

  • tickStarts(dir: string, schedArr: CompiledConstraint[], startsArr: any[], startDate: Date): void
  • Advance each startsArr[i] past startDate. Falls back to tickSafe when a DST transition makes start(tick(...)) land on the same instant again, which would otherwise loop forever.

    Parameters

    Returns void

Object literals

Static Readonly scheduleArray

scheduleArray: object

Dispatch map the schedule compiler indexes by direction string (next / prev / nextInvalid / prevInvalid / sort) at runtime.

next

next: findNextInArray = IntervalParseHelpers.findNextInArray

nextInvalid

nextInvalid: findNextInvalidInArray = IntervalParseHelpers.findNextInvalidInArray

prev

prev: findPrevInArray = IntervalParseHelpers.findPrevInArray

prevInvalid

prevInvalid: findPrevInvalidInArray = IntervalParseHelpers.findPrevInvalidInArray

sort

sort: sortArray = IntervalParseHelpers.sortArray

Generated using TypeDoc