npm / node-cron
node-cron
What changed in node-cron 4, from its official release notes, upgrade guides and advisories. Also covers @types/node-cron. Sources checked 2026-10-24.
3 breaking6 new APIs and options5 fixes and other
See which of these apply to your code, ranked, in your agent:
npx @unstale/cli initnode-cron 414 changes
Breaking changes 3
Inverted ranges expand with wrap-around instead of being silently swapped.
Validates the cron expression when scheduling a task.
Renames the task option distributedTtl to distributedLease; distributedTtl is removed without an alias.
New APIs and options 6
Adds cron.shutdown(timeout?) for graceful process teardown.
Cron expressions support Quartz-style W, L-n and ? modifiers for the day-of-month field.
Emits task:failed when a background daemon exits unexpectedly.
Adds an unref option for heartbeat timers.
Adds a ScheduledTask introspection getter that returns the date and result of the last successful execution, the date and error of the last failed execution, or null before the first run.
Adds extended day-of-week tokens for the nth weekday of the month and the last weekday of the month.
Fixes and other changes 5
Fixes CommonJS type resolution.
Correlates execute() by id, isolates event hooks, and excludes manual runs from maxExecutions counting.
Unrefs the IPC channel so background tasks let the process exit.
Fixes promise bugs that could hang scheduling or crash the process.
Lifecycle calls on a destroyed task become safe no-ops.