nxtcron - v1.0.1
    Preparing search index...

    Class CronCalculator

    Computes next/previous scheduled run times for cron expressions.

    Index

    Constructors

    Properties

    formatter: Map<string, DateTimeFormat> = ...
    instance?: CronCalculator
    parser: CronParser = ...

    Methods

    • Build UTC Date from timezone-aligned components.

      Parameters

      • year: number
      • month: number
      • day: number
      • hour: number
      • minute: number
      • tz: string

      Returns Date

    • Get number of days in month.

      Parameters

      • year: number
      • month: number

      Returns number

    • Get the day of week.

      Parameters

      • year: number
      • month: number
      • day: number

      Returns number

    • Get date time part by key.

      Parameters

      • parts: DateTimeFormatPart[]
      • key: string

      Returns number

    • Binary search: lower bound (first >= x).

      Parameters

      • arr: readonly number[]
      • x: number

      Returns number

    • Compute next N execution times.

      Parameters

      • expr: CronInput

        Cron string or pre-parsed expression

      • options: RunOptions = {}

        Run options (timezone, before, after, count)

      Returns Date[]

      calc.next( '0 9 * * MON', { count: 3, timezone: 'UTC' } );
      
    • Returns only the relevant candidates using binary search jumps. No full array scans, no filtering, no allocation loops.

      Parameters

      • arr: readonly number[]
      • min: number
      • max: number
      • cur: number
      • lvl: boolean
      • dir: -1 | 1

      Returns readonly number[]

    • Compute previous N execution times.

      Parameters

      • expr: CronInput

        Cron string or pre-parsed expression

      • options: RunOptions = {}

        Run options (timezone, before, after, count)

      Returns Date[]

      calc.prev( '0 9 * * MON', { count: 3 } );
      
    • Core jump-based scheduler. Walks year → month → day → hour → minute using binary search jumps.

      Parameters

      Returns Date | null

    • Format a date into timezone-aligned parts.

      Parameters

      • tz: string
      • date: Date

      Returns DateTimeFormatPart[]

    • Binary search: upper bound (last <= x).

      Parameters

      • arr: readonly number[]
      • x: number

      Returns number

    • Validate chronological direction correctness.

      Parameters

      • year: number
      • month: number
      • day: number
      • hour: number
      • minute: number
      • p: DateParts
      • dir: -1 | 1

      Returns boolean