Member Junction
    Preparing search index...

    Utility class for cron expression parsing and evaluation

    Index

    Constructors

    Methods

    • Estimate the minimum interval (in ms) between consecutive executions of a cron expression by sampling the next several runs and returning the smallest gap. Returns Number.POSITIVE_INFINITY if the expression cannot be parsed or yields fewer than two runs in the sample window.

      Parameters

      • cronExpression: string

        Cron expression string

      • timezone: string

        IANA timezone

      • sampleSize: number = 6

        Number of consecutive runs to sample (default: 6)

      • OptionalfromDate: Date

        Optional date to start sampling from (defaults to now)

      Returns number

    • Get the next execution time for a cron expression

      Parameters

      • cronExpression: string

        Cron expression string

      • timezone: string

        IANA timezone

      • OptionalfromDate: Date

        Optional date to calculate from (defaults to now)

      Returns Date

      Next execution date

    • Determine if a cron expression is currently due

      Parameters

      • cronExpression: string

        Cron expression string

      • timezone: string

        IANA timezone (e.g., 'America/Chicago')

      • evalTime: Date

        Time to evaluate against

      Returns boolean

      True if the expression is due at evalTime