Packages

node-cron

4.6.0 · 5 Jul 2026ISC5.7M / weekRepositoryHomepagenpmAtom feed

Upgrading node-cron from 3.0.3 to 4.6.0

17 releases in betweenevery note read

The note of 4.0.0 lists no breaking change or deprecation, which is rare for a major.
?
changes to make
0
advisories fixed
23
new
33
fixes

Release by release

  1. 4.6.0

    5 Jul 20265 new · 19 fixes
    • 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

  2. 4.5.0

    21 Jun 20268 new · 1 fix
    • new

      lastRun() introspection getter on ScheduledTask: returns { date, result } after a successful execution, { date, error } after a failed one, or null before the first run.

    • new

      Extended day-of-week tokens: <weekday>#<nth> (nth weekday of the month, e.g. 1#1 for the first Monday) and <weekday>L (last weekday of the month, e.g. 5L for the last Friday).

    • new

      Cache Intl.DateTimeFormat instances per timezone instead of rebuilding on every call.

    • new

      Parse the cron expression once per TimeMatcher instead of re-parsing in MatcherWalker.

  3. 4.4.1nothing new or fixed in the note

  4. 4.4.0

    18 Jun 20263 new · 1 fix
    • new

      Distributed run coordination — opt-in distributed: true runs a task on a single instance per fire across a fleet (the #477 use case). Ships a built-in NODE_CRON_RUN env-var default (one designated runner, no dependencies) and a pluggable RunCoordinator (via setRunCoordinator, or the per-task runCoordinator option) for high-availability, per-fire coordination (e.g. a Redis lock). Adds the distributedTtl option and an execution:skipped event carrying a reason ('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() and getPattern().

    • new

      cron.parse(expression) and cron.validateDetailed(expression) — decompose an expression into its fields, or get every field-level problem (without throwing) for tooling and richer error messages.

    • fixed

      getNextMatch no 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.

  5. 4.3.0

    17 Jun 20263 new · 3 fixes
    • new

      L (last day of month) in the day-of-month field — e.g. 0 0 12 L * *, leap-year aware, and combinable with explicit days (15,L). (#396, closes #147 — thanks @antonidasyang)

    • new

      missedExecutionTolerance option (ms, default 1000): a heartbeat that wakes a little late still runs its slot instead of being reported as missed. Always capped to the gap to the next slot. (#534, closes #485)

    • new

      startTimeout option for background tasks (ms, default 5000).

    • fixed

      Rewrote getNextMatch for correctness around DST: no more ~1-year overshoot when a daily time falls in the spring-forward gap. (#533, closes #518)

    • fixed

      Background task start failures now reject with the real cause (e.g. unsupported TypeScript syntax, missing file) instead of an opaque timeout, and a failed/timed-out start no longer leaves an orphaned daemon running. (#535, closes #484)

    • fixed

      Long-timer drift no longer produces spurious "missed execution" warnings / skipped runs on daily/weekly schedules. (#534, closes #485)

  6. 4.2.1

    10 Jul 20251 fix
    • fixed

      ESM/CJS interop and task-file import on Windows.

  7. 4.2.0

    1 Jul 20251 new
    • new

      getTasks() and getTask(id) to inspect the task registry.

  8. 4.1.1

    20 Jun 20251 fix
    • fixed

      Overlap prevention (noOverlap).

7 other lines we could not sort, mostly version bumps
  • Replace chai and sinon with native vitest assertions

    4.6.0
  • Renamed internal functions interprete to interpret and appendSeccondExpression to appendSecondExpression.

    4.5.0
  • Rewritten README and package metadata to surface scheduling capabilities (overlap prevention, distributed coordination, background tasks).

    4.5.0
  • Renamed the distributedTtl task option to distributedLease (same meaning: the safety lease, in ms, for lease-based run coordinators). distributedTtl was 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 adopted distributedTtl from 4.4.0, rename it to distributedLease.

    4.4.1
  • Supported Node.js is now >= 20 (was >= 20.11), tested on Node 20, 22 and 24.

    4.3.0
  • missedExecutionTolerance defaults to 1000ms, so a scheduled run that wakes up to ~1s late now executes instead of emitting execution:missed. This is a bug-fix improvement, not an API break.

    4.3.0
  • v4 - migrating to typescript

    4.0.0

4 internal lines (docs, tests, tooling) left out.