node-cron
4.6.0 · 5 Jul 2026ISC5.7M / weekRepositoryHomepagenpmAtom feed
Upgrading node-cron from 4.3.0 to 4.6.0
4 releases in betweenevery note read
Release by release
- new
Add cron.shutdown(timeout?) for graceful process teardown
- new
Add unref option for heartbeat timers
- new
day-of-month: Quartz-style W, L-n and ? modifiers
- new
Emit task:failed when a background daemon exits unexpectedly
- new
- new
lastRun()introspection getter onScheduledTask: returns{ date, result }after a successful execution,{ date, error }after a failed one, ornullbefore the first run. - new
Extended day-of-week tokens:
<weekday>#<nth>(nth weekday of the month, e.g.1#1for the first Monday) and<weekday>L(last weekday of the month, e.g.5Lfor the last Friday). - new
Cache
Intl.DateTimeFormatinstances per timezone instead of rebuilding on every call. - new
Parse the cron expression once per
TimeMatcherinstead of re-parsing inMatcherWalker.
- new
4.4.1nothing new or fixed in the note
- new
Distributed run coordination — opt-in
distributed: trueruns a task on a single instance per fire across a fleet (the #477 use case). Ships a built-inNODE_CRON_RUNenv-var default (one designated runner, no dependencies) and a pluggableRunCoordinator(viasetRunCoordinator, or the per-taskrunCoordinatoroption) for high-availability, per-fire coordination (e.g. a Redis lock). Adds thedistributedTtloption and anexecution:skippedevent carrying areason('not-elected'|'coordinator-error'). Works for inline and background tasks. (#549, closes #477) - new
Task introspection on
ScheduledTask:getNextRuns(n)(preview the next N run times),match(date),msToNext(),isBusy(),runsLeft()andgetPattern(). - new
cron.parse(expression)andcron.validateDetailed(expression)— decompose an expression into its fields, or get every field-level problem (without throwing) for tooling and richer error messages. - fixed
getNextMatchno longer scans every time of day on a day that matches the day-of-month but not the weekday. A dense expression constrained by both (e.g.* * * 15 * 1) could take minutes to resolve; it is now instant.
- new
4 other lines we could not sort, mostly version bumps
- 4.6.0
Replace chai and sinon with native vitest assertions
- 4.5.0
Renamed internal functions
interpretetointerpretandappendSeccondExpressiontoappendSecondExpression. - 4.5.0
Rewritten README and package metadata to surface scheduling capabilities (overlap prevention, distributed coordination, background tasks).
- 4.4.1
Renamed the
distributedTtltask option todistributedLease(same meaning: the safety lease, in ms, for lease-based run coordinators).distributedTtlwas the only abbreviation in the options API and shipped just days ago in 4.4.0, so it's removed without an alias. If you adopteddistributedTtlfrom 4.4.0, rename it todistributedLease.
2 internal lines (docs, tests, tooling) left out.