Skip to main content

Class: Cron

Handles Cron strings and generates dates based on the cron string provided.

See

https://en.wikipedia.org/wiki/Cron

Constructors

new Cron()

new Cron(cron: string): Cron

Parameters

ParameterTypeDescription
cronstringThe cron pattern to use

Returns

Cron

Defined in

Cron.ts:20

Properties

cron

cron: string

Defined in

Cron.ts:9


days

days: number[]

Defined in

Cron.ts:13


dows

dows: number[]

Defined in

Cron.ts:15


hours

hours: number[]

Defined in

Cron.ts:12


minutes

minutes: number[]

Defined in

Cron.ts:11


months

months: number[]

Defined in

Cron.ts:14


normalized

normalized: string

Defined in

Cron.ts:10

Methods

next()

next(outset: Date, origin: boolean): Date

Get the next date that matches with the current pattern

Parameters

ParameterTypeDefault valueDescription
outsetDate...The Date instance to compare with
originbooleantrueWhether this next call is origin

Returns

Date

Defined in

Cron.ts:31


toString()

toString(): string

Returns the string that represents this cron pattern

Returns

string

The string that represents this cron pattern

Defined in

Cron.ts:55


normalize()

private static normalize(cron: string): string

Normalize the pattern

Parameters

ParameterTypeDescription
cronstringThe pattern to normalize

Returns

string

Defined in

Cron.ts:63


parsePart()

private static parsePart(cronPart: string, id: number): number[]

Parse the current part

Parameters

ParameterTypeDescription
cronPartstringThe part of the pattern to parse
idnumberThe id that identifies the current part

Returns

number[]

Defined in

Cron.ts:109


parseString()

private static parseString(cron: string): number[][]

Parse the pattern

Parameters

ParameterTypeDescription
cronstringThe pattern to parse

Returns

number[][]

Defined in

Cron.ts:98