Skip to content

Using / with year creates RangeError #373

@amao-cbw

Description

@amao-cbw

Describe the bug
When using the / option on the year in the cronstring, it will throw the following error

RangeError: CronPattern: Invalid value for year: 0 (supported range: 1-9999)

To Reproduce

import { Cron } from "croner";

const job = new Cron('* * * * * * */2', () => {
    console.log('Event triggered at: ', new Date().toLocaleTimeString());
});

Expected behavior
The ability to select every other year

System:

  • OS: Windows 11 Pro
  • Runtime Node.js
  • Runtime Version v24.14.1
  • Croner Version 10.0.1

Metadata

Metadata

Labels

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions