Skip to content

Commit 2bfa140

Browse files
authored
Merge pull request #12 from sospartan/sospartan-fix-aliases
Update cron expression aliases with correct timings
2 parents 8bc49c6 + 6742407 commit 2bfa140

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

lib/parser.ts

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,24 @@ class CronParser<T extends string> implements ICronParser {
2121

2222
/**
2323
* A map of cron expression aliases to their corresponding cron expressions.
24+
* * * * * * * (second minute hour day month day-of-week)
25+
* | | | | | |
26+
* | | | | | +-- day of the week (0 - 6) (Sunday to Saturday)
27+
* | | | | +---- month (1 - 12)
28+
* | | | +------ day of the month (1 - 31)
29+
* | | +-------- hour (0 - 23)
30+
* | +---------- minute (0 - 59)
31+
* +------------ second (0 - 59)
2432
*/
2533
private readonly aliases: Map<CronExpression, string> = new Map([
2634
["@every_second", "* * * * * *"],
2735
["@every_minute", "0 * * * * *"],
28-
["@yearly", "0 0 1 1 * *"],
29-
["@annually", "0 0 1 1 * *"],
30-
["@monthly", "0 0 1 * * *"],
31-
["@weekly", "0 0 * * 0 *"],
32-
["@daily", "0 0 * * * *"],
33-
["@hourly", "0 * * * * *"],
36+
["@yearly", "0 0 0 1 1 *"], // 00:00:00 at day 1 of month and Jan
37+
["@annually", "0 0 0 1 1 *"], // 00:00:00 at day 1 of month and Jan
38+
["@monthly", "0 0 0 1 * *"], // 00:00:00 at day 1 of month
39+
["@weekly", "0 0 0 * * 0"], // 00:00:00 at sun
40+
["@daily", "0 0 0 * * *"], // 00:00:00 every day
41+
["@hourly", "0 0 * * * *"], // 00:00 every hour
3442
]);
3543

3644
/**

0 commit comments

Comments
 (0)