Libraries v5.0.0
    Preparing search index...

    Class ScheduleCalculator

    Deterministic calendar iterator. Supply startsOn for reproducible sequences.

    Index
    • Parameters

      • schedule:
            | {
                endsOn?: Date;
                every: "minute";
                interval?: number;
                maxOccurences?: number;
                maxOccurrences?: number;
                skipFirst?: number;
                startsOn?: Date;
                timeZone?: string;
            }
            | {
                endsOn?: Date;
                every: "day";
                hour?: number;
                interval?: number;
                maxOccurences?: number;
                maxOccurrences?: number;
                minute?: number;
                skipFirst?: number;
                startsOn?: Date;
                timeZone?: string;
            }
            | {
                dayOfWeek: number[];
                endsOn?: Date;
                every: "week";
                hour?: number;
                interval?: number;
                maxOccurences?: number;
                maxOccurrences?: number;
                minute?: number;
                skipFirst?: number;
                startsOn?: Date;
                timeZone?: string;
            }
            | {
                day: number
                | "last";
                endsOn?: Date;
                every: "month";
                hour?: number;
                interval?: number;
                maxOccurences?: number;
                maxOccurrences?: number;
                minute?: number;
                skipFirst?: number;
                startsOn?: Date;
                timeZone?: string;
            }
            | {
                day: number
                | "last";
                endsOn?: Date;
                every: "year";
                hour?: number;
                interval?: number;
                maxOccurences?: number;
                maxOccurrences?: number;
                minute?: number;
                month: number;
                skipFirst?: number;
                startsOn?: Date;
                timeZone?: string;
            }
        • {
              endsOn?: Date;
              every: "minute";
              interval?: number;
              maxOccurences?: number;
              maxOccurrences?: number;
              skipFirst?: number;
              startsOn?: Date;
              timeZone?: string;
          }
          • OptionalendsOn?: Date

            Inclusive end; JSON date strings are accepted at validation boundaries.

          • every: "minute"
          • Optionalinterval?: number

            Number of periods between occurrences; defaults to 1.

          • OptionalmaxOccurences?: number

            Use maxOccurrences. Supplying both spellings is invalid.

          • OptionalmaxOccurrences?: number

            Maximum calendar slots, including skipped slots, not successful executions.

          • OptionalskipFirst?: number

            Number of initial calendar slots to skip; defaults to 0.

          • OptionalstartsOn?: Date

            Inclusive start; omitted starts are anchored once by the repository clock.

          • OptionaltimeZone?: string

            Named IANA time zone; defaults to UTC. Fixed numeric offsets are rejected.

        • {
              endsOn?: Date;
              every: "day";
              hour?: number;
              interval?: number;
              maxOccurences?: number;
              maxOccurrences?: number;
              minute?: number;
              skipFirst?: number;
              startsOn?: Date;
              timeZone?: string;
          }
          • OptionalendsOn?: Date

            Inclusive end; JSON date strings are accepted at validation boundaries.

          • every: "day"
          • Optionalhour?: number

            Local hour, 0–23; defaults to 9 for calendar schedules.

          • Optionalinterval?: number

            Number of periods between occurrences; defaults to 1.

          • OptionalmaxOccurences?: number

            Use maxOccurrences. Supplying both spellings is invalid.

          • OptionalmaxOccurrences?: number

            Maximum calendar slots, including skipped slots, not successful executions.

          • Optionalminute?: number

            Local minute, 0–59; defaults to 0 for calendar schedules.

          • OptionalskipFirst?: number

            Number of initial calendar slots to skip; defaults to 0.

          • OptionalstartsOn?: Date

            Inclusive start; omitted starts are anchored once by the repository clock.

          • OptionaltimeZone?: string

            Named IANA time zone; defaults to UTC. Fixed numeric offsets are rejected.

        • {
              dayOfWeek: number[];
              endsOn?: Date;
              every: "week";
              hour?: number;
              interval?: number;
              maxOccurences?: number;
              maxOccurrences?: number;
              minute?: number;
              skipFirst?: number;
              startsOn?: Date;
              timeZone?: string;
          }
          • dayOfWeek: number[]
          • OptionalendsOn?: Date

            Inclusive end; JSON date strings are accepted at validation boundaries.

          • every: "week"
          • Optionalhour?: number

            Local hour, 0–23; defaults to 9 for calendar schedules.

          • Optionalinterval?: number

            Number of periods between occurrences; defaults to 1.

          • OptionalmaxOccurences?: number

            Use maxOccurrences. Supplying both spellings is invalid.

          • OptionalmaxOccurrences?: number

            Maximum calendar slots, including skipped slots, not successful executions.

          • Optionalminute?: number

            Local minute, 0–59; defaults to 0 for calendar schedules.

          • OptionalskipFirst?: number

            Number of initial calendar slots to skip; defaults to 0.

          • OptionalstartsOn?: Date

            Inclusive start; omitted starts are anchored once by the repository clock.

          • OptionaltimeZone?: string

            Named IANA time zone; defaults to UTC. Fixed numeric offsets are rejected.

        • {
              day: number | "last";
              endsOn?: Date;
              every: "month";
              hour?: number;
              interval?: number;
              maxOccurences?: number;
              maxOccurrences?: number;
              minute?: number;
              skipFirst?: number;
              startsOn?: Date;
              timeZone?: string;
          }
          • day: number | "last"
          • OptionalendsOn?: Date

            Inclusive end; JSON date strings are accepted at validation boundaries.

          • every: "month"
          • Optionalhour?: number

            Local hour, 0–23; defaults to 9 for calendar schedules.

          • Optionalinterval?: number

            Number of periods between occurrences; defaults to 1.

          • OptionalmaxOccurences?: number

            Use maxOccurrences. Supplying both spellings is invalid.

          • OptionalmaxOccurrences?: number

            Maximum calendar slots, including skipped slots, not successful executions.

          • Optionalminute?: number

            Local minute, 0–59; defaults to 0 for calendar schedules.

          • OptionalskipFirst?: number

            Number of initial calendar slots to skip; defaults to 0.

          • OptionalstartsOn?: Date

            Inclusive start; omitted starts are anchored once by the repository clock.

          • OptionaltimeZone?: string

            Named IANA time zone; defaults to UTC. Fixed numeric offsets are rejected.

        • {
              day: number | "last";
              endsOn?: Date;
              every: "year";
              hour?: number;
              interval?: number;
              maxOccurences?: number;
              maxOccurrences?: number;
              minute?: number;
              month: number;
              skipFirst?: number;
              startsOn?: Date;
              timeZone?: string;
          }
          • day: number | "last"
          • OptionalendsOn?: Date

            Inclusive end; JSON date strings are accepted at validation boundaries.

          • every: "year"
          • Optionalhour?: number

            Local hour, 0–23; defaults to 9 for calendar schedules.

          • Optionalinterval?: number

            Number of periods between occurrences; defaults to 1.

          • OptionalmaxOccurences?: number

            Use maxOccurrences. Supplying both spellings is invalid.

          • OptionalmaxOccurrences?: number

            Maximum calendar slots, including skipped slots, not successful executions.

          • Optionalminute?: number

            Local minute, 0–59; defaults to 0 for calendar schedules.

          • month: number
          • OptionalskipFirst?: number

            Number of initial calendar slots to skip; defaults to 0.

          • OptionalstartsOn?: Date

            Inclusive start; omitted starts are anchored once by the repository clock.

          • OptionaltimeZone?: string

            Named IANA time zone; defaults to UTC. Fixed numeric offsets are rejected.

      Returns ScheduleCalculator

    • Whether an occurrence remains, optionally within a look-ahead window.

      Parameters

      • OptionalwithinMs: number

      Returns boolean

    • Advance one occurrence; index is one-based and includes skipped calendar slots.

      Returns { date: Date; index: number }