date-fns avatar

date-fns Release Notes & Changelog

date-fns/date-fns

The latest date-fns release is v4.4.0, published on .

⏳ Modern JavaScript date utility library ⌛️

36,649 starsTypeScriptv4.4.0
javascriptdatemodulesutilitiesnodejstimedate-fnshacktoberfest

date-fns release notes

v5 focuses on reducing the date-fns package size. Compared to v4.3.0, this version reduces the zipped package size from 5.83 MB down to 2.89 MB.

It removes the CDN scripts from the date-fns package and moves them to a separate @date-fns/cdn package.

It is just the first step in optimizing the package size. Expect further size reduction in the future versions.

Changed

  • BREAKING: The CDN scripts are now available via the @date-fns/cdn npm package instead of date-fns. Users relying on the latest CDN version (e.g., https://cdn.jsdelivr.net/npm/date-fns/cdn.min.js) would be served a polyfill that

This release revisits the approach to CDN usage and introduces a new package, @date-fns/cdn and deprecates the date-fns CDN scripts. It allowed reducing the zipped package size from 5.83 MB down to 3.96 MB without introducing any breaking changes.

In v5.0.0-alpha.0 where CDN scripts are completely removed from date-fns the change is more significant and brings the zipped package size down to 2.89 MB.

It is just the first step in optimizing the package size. Expect further size reduction in the future v4 and v5 versions.

Changed

  • DEPRECATED: The date-fns CDN scripts are now deprecated and will be

This is a minor release in all senses, it only includes documentation updates (first of many) that points to the new You Don't Need date-fns* page.

* Not really

Changed

  • Added Temporal API references to the JSDoc annotations of add, addBusinessDays, and addDays.

This release adds time zone support to format functions (that I somehow missed when working on the feature) and fixes a few bugs.

Make sure also upgrade TZDate to v1.0.2 as it includes a bunch of critical bug fixes.

Fixed

  • Fixed internal constructFrom throwing an exception on null arguments. While null isn't allowed, the functions should rather return Invalid Date or NaN in such cases. See #3885.

Added

  • Added missing time zone support to format, formatISO, formatISO9075, formatRelative and formatRFC3339. See #3886.

I have great news! First, ten years after its release, date-fns finally gets first-class time zone support.

Another great news is that there aren't many breaking changes in this release. All of them are type-related and will affect only those explicitly using internal date-fns types. Finally, it has been less than a year since the last major release, which is an improvement over the previous four years between v2 and v3. I plan on keeping the pace and minimizing breaking changes moving forward.

Read more about the release in the announcement blog post.

- Sasha @kossnocorp

Kudos to @fturmel, @kossnocorp, @makstyle119, @tan75, @marcreichel, @tareknatsheh and @audunru for working on the release. Also, thanks to @seated for sponsoring me.

Fixed

Added

Looking for an older version? The full date-fns changelog is on the official date-fns/date-fns releases page.

How to get notified of new date-fns releases

Stay updated when date-fns ships a new version. With GitWatchman, you can monitor date-fns/date-fns and receive the full release notes by email, Slack, Discord or Telegram whenever a new version is published.

  1. Sign in with your GitHub or Google account at gitwatchman.com
  2. Add date-fns/date-fns to your monitored repositories
  3. Get an alert with the release notes for every new version

You can also subscribe to the RSS feed for date-fns releases (see our GitHub release RSS guide), follow date-fns pre-releases and betas, or compare the best GitHub release trackers.

Related projects to track

Get notified of new date-fns releases

One alert per release with the full notes, by email, Slack, Discord or Telegram. Free for up to 5 repositories.

Track date-fns for free