Class: Cron
@sapphire/cron.Cron
Handles Cron strings and generates dates based on the cron string provided.
See
https://en.wikipedia.org/wiki/Cron
Constructors
constructor
• new Cron(cron
)
Parameters
Name | Type | Description |
---|---|---|
cron | string | The cron pattern to use |
Defined in
Properties
cron
• cron: string
Defined in
days
• days: number
[]
Defined in
dows
• dows: number
[]
Defined in
hours
• hours: number
[]
Defined in
minutes
• minutes: number
[]
Defined in
months
• months: number
[]
Defined in
normalized
• normalized: string
Defined in
Methods
next
▸ next(outset?
, origin?
): Date
Get the next date that matches with the current pattern
Parameters
Name | Type | Default value | Description |
---|---|---|---|
outset | Date | undefined | The Date instance to compare with |
origin | boolean | true | Whether this next call is origin |
Returns
Defined in
normalize
▸ Private
Static
normalize(cron
): string
Normalize the pattern
Parameters
Name | Type | Description |
---|---|---|
cron | string | The pattern to normalize |
Returns
string
Defined in
parsePart
▸ Private
Static
parsePart(cronPart
, id
): number
[]
Parse the current part
Parameters
Name | Type | Description |
---|---|---|
cronPart | string | The part of the pattern to parse |
id | number | The id that identifies the current part |
Returns
number
[]
Defined in
parseString
▸ Private
Static
parseString(cron
): number
[][]
Parse the pattern
Parameters
Name | Type | Description |
---|---|---|
cron | string | The pattern to parse |
Returns
number
[][]