P4sca1 / cron-schedule

A zero-dependency cron parser and scheduler for Node.js, Deno and the browser.
MIT License
172 stars 14 forks source link

Parsing "@monthly" returns a months array of [0] #323

Closed zachsents closed 3 weeks ago

zachsents commented 3 weeks ago

Like title says. Other macros like @hourly and @daily work correctly.

See this snippet:

import { parseCronExpression } from "cron-schedule"

parseCronExpression("@monthly").months
// [ 0 ]

parseCronExpression("0 0 1 * *").months
// [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 ]

parseCronExpression("@hourly").months
// [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 ]
zachsents commented 3 weeks ago

Test case is also incorrect: https://github.com/P4sca1/cron-schedule/blob/11a23c95f652c52997e1cc1024434cc288157f69/test/cron-parser.test.ts#L350C1-L354C4