unstale

npm / date-fns

date-fns

What changed in date-fns 3 to 4, from its official release notes, upgrade guides and advisories. Also covers @date-fns/tz. Sources checked 2026-11-30.

22 breaking1 deprecations7 new APIs and options4 behavior and defaults6 fixes and other

See which of these apply to your code, ranked, in your agent:

npx @unstale/cli init

@unstale/cli on npm

date-fns 414 changes

Breaking changes 2

  • CDN source maps were removed from date-fns; users relying on them should switch to @date-fns/cdn.

    4.4.0release notes

  • Breaking type changes affect users explicitly using internal date-fns types; the notes recommend running the type checker after upgrading.

    4.0.0release notes

Deprecations 1

  • CDN scripts are deprecated and will be removed in the next major release; use @date-fns/cdn instead.

    4.4.0release notes

New APIs and options 3

  • Introduces a package for CDN usage that includes CDN source maps.

    4.4.0release notes

  • Time zone support is available via the TZDate class and tz helper function.

    4.0.0release notes

  • Relevant functions accept the context in option to specify the time zone used for calculations; date results use that time zone.

    4.0.0release notes

Behavior and default changes 2

  • Function arguments and Interval endpoints can use different date types or primitives; values are normalized and results use the type inferred from the context or first encountered argument object.

    4.0.0release notes

  • The package is now ESM-first while continuing to support CommonJS, which may affect some environments.

    4.0.0release notes

Fixes and other changes 6

  • Corrects the pt locale so its first day of the week is Sunday.

    4.3.0release notes

  • Fixes month parsing for October, November, and December in the zh-CN locale.

    4.3.0release notes

  • Fixes month parsing for October, November, and December in the zh-HK locale.

    4.3.0release notes

  • Fixes month parsing for October, November, and December in the zh-TW locale.

    4.3.0release notes

  • Restores type definitions that were missing in v4.2.0 due to a TypeScript misconfiguration.

    4.2.1release notes

  • CDN builds now work with jQuery and other tools that expose $, by wrapping the code in an IIFE.

    4.0.0release notes

date-fns 326 changes

Breaking changes 20

  • Intervals are normalized before comparison; invalid interval properties produce false except for the stated inclusive case when the other values are valid and equal.

    3.0.0release notes

  • Functions no longer check the number of passed arguments, delegating this task to type checkers.

    3.0.0release notes

  • Arguments are no longer explicitly converted to target types; conversion is delegated to type checkers.

    3.0.0release notes

  • Constants are no longer exported from the index; import them from date-fns/constants instead.

    3.0.0release notes

  • The package now has a flat structure, with functions and locales available at paths such as node_modules/date-fns/add.mjs and node_modules/date-fns/locale/enUS.mjs.

    3.0.0release notes

  • The eachXOfInterval functions return reversed arrays for reversed intervals and empty arrays for invalid properties; step may be negative, 0, or NaN.

    3.0.0release notes

  • Flow is no longer supported.

    3.0.0release notes

  • Intervals are normalized before comparison, and any Invalid Date property makes the function return 0.

    3.0.0release notes

  • Internet Explorer is no longer supported.

    3.0.0release notes

  • Functions accepting Interval arguments no longer throw for reversed or invalid intervals; they handle them as negative or invalid intervals.

    3.0.0release notes

  • A new function validates intervals, emulating the v2 interval functions behavior.

    3.0.0release notes

  • Negative intervals produce negative durations, invalid interval properties produce an empty object, and zero values are omitted from the result.

    3.0.0release notes

  • Intervals are normalized before comparison; any Invalid Date property makes the function return false.

    3.0.0release notes

  • Locales now use regular functions instead of the UTC version, which may affect code that uses locales directly.

    3.0.0release notes

  • ESM files now use the .mjs extension.

    3.0.0release notes

  • Exports are now named rather than default, so direct imports must use named-import syntax.

    3.0.0release notes

  • The undocumented onlyNumeric option was removed from the nn and sv locales.

    3.0.0release notes

  • Functions use Math.trunc rounding where rounding is required; behavior is configurable per function.

    3.0.0release notes

  • An out-of-range nearestTo option now returns Invalid Date instead of throwing.

    3.0.0release notes

  • TypeScript types have been completely rewritten, so existing TypeScript usage may need adjustment.

    3.0.0release notes

New APIs and options 4

  • All functions that accept date arguments now also accept strings.

    3.0.0release notes

  • differenceInX functions now accept options with a roundingMethod setting; Math.trunc is the default.

    3.0.0release notes

  • The step option is now accepted.

    3.0.0release notes

  • All functions now export options interfaces.

    3.0.0release notes

Behavior and default changes 2

  • Functions accept custom Date extensions and use the arguments' constructor to generate a result of the same class.

    3.0.0release notes

  • The package now supports both ESM and CommonJS, with file exports explicitly defined in package.json.

    3.0.0release notes