Skip to main content

Class: Cron

Defined in: Cron.ts:8

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

See​

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

Constructors​

Constructor​

new Cron(cron: string): Cron

Defined in: Cron.ts:20

Parameters​

ParameterTypeDescription
cronstringThe cron pattern to use

Returns​

Cron

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

Defined in: Cron.ts:31

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


toString()​

toString(): string

Defined in: Cron.ts:55

Returns the string that represents this cron pattern

Returns​

string

The string that represents this cron pattern


normalize()​

private static normalize(cron: string): string

Defined in: Cron.ts:63

Normalize the pattern

Parameters​

ParameterTypeDescription
cronstringThe pattern to normalize

Returns​

string


parsePart()​

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

Defined in: Cron.ts:109

Parse the current part

Parameters​

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

Returns​

number[]


parseString()​

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

Defined in: Cron.ts:98

Parse the pattern

Parameters​

ParameterTypeDescription
cronstringThe pattern to parse

Returns​

number[][]