Packages

cron-parser

5.10.6 · 14 Nov 2026MIT34.2M / weekRepositoryHomepagenpmAtom feed

Your version

5.0.0

major13 Feb 2025Where it was published

5.10.6 is the newest release of 5.x.

In short

4 breaking2 new2 fixed3 changed1 internal

  • Breaking

    Bumped the minimum Node.js version to >= 18 and TypeScript to >= 5.

  • Breaking

    interval.fields (CronExpression.interval) now returns a readonly instance of CronFieldsCollection instead of a regular array. See CronFieldsCollection.from for how to modify the underlying data structure.

  • Breaking

    Moved crontab file parsing from CronParser to a standalone CronFileParser class (fixes #112).

  • Breaking

    Removal of utc flag from the options. Pass in UTC timezone instead.

Release note

All changes come from #360

Changelog

  • Breaking

    Bumped the minimum Node.js version to >= 18 and TypeScript to >= 5.

  • Breaking

    interval.fields (CronExpression.interval) now returns a readonly instance of CronFieldsCollection instead of a regular array. See CronFieldsCollection.from for how to modify the underlying data structure.

  • Breaking

    Moved crontab file parsing from CronParser to a standalone CronFileParser class (fixes #112).

  • Breaking

    Removal of utc flag from the options. Pass in UTC timezone instead.

  • Refactored the codebase to TypeScript (fixes #190).

  • Improved documentation and introduced documentation generated by typedoc (fixes #309, #322, #269).

  • Added benchmark tooling to help detect future performance regressions.

  • Added CronExpression.includesDate to evaluate whether a given date matches the pattern (closes #299).

  • Fixed issues where certain range and repeat field expressions produced invalid intervals (fixes #156).

  • Fixed an issue with day-of-month handling when the range is explicitly set and no wildcard is used (fixes #284).

  • Improved repeat serialization for stringification (fixes #236).

Performance improvements

While this release won't address the performance issues reported in #287, it will bring some performance improvements of around 20-30% on average, depending on the pattern complexity. The following benchmark results were produced on my 2023 MBP.

┌────────────────────┬────────────┬────────────┬──────────┬─────┐ │ Pattern │ Old Mean │ New Mean │ Change │ │ ├────────────────────┼────────────┼────────────┼──────────┼─────┤ │ * * * * * * │ 73.55ms │ 37.43ms │ 49.10% │ ↑ │ ├────────────────────┼────────────┼────────────┼──────────┼─────┤ │ 0 * * 1,4-10,L * * │ 3504.51ms │ 2338.42ms │ 33.27% │ ↑ │ ├────────────────────┼────────────┼────────────┼──────────┼─────┤ │ 10-30/2 2 12 8 0 │ 3111.18ms │ 2234.32ms │ 28.18% │ ↑ │ ├────────────────────┼────────────┼────────────┼──────────┼─────┤ │ 0 0 0 * * 4,6L │ 9400.33ms │ 6825.61ms │ 27.39% │ ↑ │ ├────────────────────┼────────────┼────────────┼──────────┼─────┤ │ 0 12 */5 6 * │ 7442.68ms │ 5645.95ms │ 24.14% │ ↑ │ ├────────────────────┼────────────┼────────────┼──────────┼─────┤ │ 0 15 */5 5 * │ 6998.87ms │ 5443.22ms │ 22.23% │ ↑ │ ├────────────────────┼────────────┼────────────┼──────────┼─────┤ │ 0 0 6-20/2,L 2 * │ 8832.87ms │ 6947.63ms │ 21.34% │ ↑ │ ├────────────────────┼────────────┼────────────┼──────────┼─────┤ │ 0 0 0 * * 1L,5L │ 15416.07ms │ 12474.12ms │ 19.08% │ ↑ │ ├────────────────────┼────────────┼────────────┼──────────┼─────┤ │ 10 2 12 8 7 │ 7105.79ms │ 5947.91ms │ 16.29% │ ↑ │ └────────────────────┴────────────┴────────────┴──────────┴─────┘

Benchmarks can be run locally by executing the command.:

npm run bench

Individual patterns can be benchmarked by executing bench:pattern command:

npm run bench:pattern "* * * * * *"

A whole project to check? Paste its package.json in the dependency check: every deprecated, outdated or vulnerable dependency, with what to upgrade to. Free, no account.