Skip to content

Update dependency date-fns to v4#18

Open
renovate[bot] wants to merge 1 commit intomainfrom
renovate/date-fns-4.x
Open

Update dependency date-fns to v4#18
renovate[bot] wants to merge 1 commit intomainfrom
renovate/date-fns-4.x

Conversation

@renovate
Copy link
Copy Markdown
Contributor

@renovate renovate Bot commented Dec 6, 2025

This PR contains the following updates:

Package Change Age Confidence
date-fns ^3^4.0.0 age confidence

Release Notes

date-fns/date-fns (date-fns)

v4.1.0

Compare Source

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.

v4.0.0

Compare Source

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

Added
  • Added time zones support via @date-fns/tz's TZDate class and tz helper function. See its README for the details about the API.

  • All relevant functions now accept the context in option, which allows to specify the time zone to make the calculations in. If the function also returns a date, it will be in the specified time zone:

    import { addDays, startOfDay } from "date-fns";
    import { tz } from "@​date-fns/tz";
    
    startOfDay(addDays(Date.now(), 5, { in: tz("Asia/Singapore") }));
    //=> "2024-09-16T00:00:00.000+08:00"

    In the example, addDays will get the current date and time in Singapore and add 5 days to it. startOfDay will inherit the date type and return the start of the day in Singapore.

Changed
  • The function arguments, as well as Interval's start and end, now can be of different types, allowing you to mix UTCDate, TZDate, Date, and other extensions, as well as primitives (strings and numbers).

    The functions will normalize these values, make calculations, and return the result in the same type, preventing any bugs caused by the discrepancy. If passed, the type will be inferred from the context in option or the first encountered argument object type. The Interval's start and end will be considered separately, starting from start.

    In the given example, the result will be in the TZDate as the first argument is a number, and the start takes precedence over the end.

    clamp(Date.now(), {
      start: new TZDate(start, "Asia/Singapore"),
      end: new UTCDate(),
    });
    //=> TZDate
  • BREAKING: This release contains a bunch of types changes that should not affect the library's expected usage. The changes are primarily internal and nuanced, so rather than listing them here, I recommend you running the type checker after the upgrade. If there are unfixable problems, please open an issue.

  • BREAKING: The package now is ESM-first. The CommonJS is still support and It should not affect most users, but it might break in certains environments. If you encounter any issues, please report them.

Fixed
  • Fixed CDN build compatibility with jQuery and other tools that expose $ by properly wrapping the code in an IIFE.

Configuration

📅 Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.

Rebasing: Whenever PR is behind base branch, or you tick the rebase/retry checkbox.

🔕 Ignore: Close this PR and you won't be reminded about this update again.


  • If you want to rebase/retry this PR, check this box

This PR was generated by Mend Renovate. View the repository job log.

@renovate renovate Bot added the renovate label Dec 6, 2025
@vercel
Copy link
Copy Markdown

vercel Bot commented Dec 6, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
byos-sample-app Ready Ready Preview, Comment Apr 29, 2026 5:50pm

Request Review

@renovate renovate Bot force-pushed the renovate/date-fns-4.x branch from 2ab5a34 to 3e9683f Compare December 12, 2025 12:05
@renovate renovate Bot force-pushed the renovate/date-fns-4.x branch from 3e9683f to d5c5f2f Compare December 12, 2025 23:31
@renovate renovate Bot force-pushed the renovate/date-fns-4.x branch from d5c5f2f to 4f80c93 Compare December 31, 2025 18:12
@renovate renovate Bot force-pushed the renovate/date-fns-4.x branch from 4f80c93 to 62bb26b Compare January 8, 2026 20:48
@renovate renovate Bot force-pushed the renovate/date-fns-4.x branch from 62bb26b to f68e5ea Compare January 23, 2026 21:41
@renovate renovate Bot force-pushed the renovate/date-fns-4.x branch from f68e5ea to 52de879 Compare January 28, 2026 12:32
@renovate renovate Bot force-pushed the renovate/date-fns-4.x branch from 52de879 to c8ba15a Compare January 28, 2026 22:46
@renovate renovate Bot force-pushed the renovate/date-fns-4.x branch from c8ba15a to d7deb11 Compare January 29, 2026 03:02
@renovate renovate Bot force-pushed the renovate/date-fns-4.x branch from d7deb11 to 9aa7e61 Compare February 2, 2026 16:33
@renovate renovate Bot force-pushed the renovate/date-fns-4.x branch from 9aa7e61 to 0ad0ec3 Compare February 12, 2026 12:48
@renovate renovate Bot force-pushed the renovate/date-fns-4.x branch from 0ad0ec3 to 325120b Compare February 17, 2026 17:59
@renovate renovate Bot force-pushed the renovate/date-fns-4.x branch from 325120b to e398b29 Compare March 8, 2026 09:07
@renovate renovate Bot force-pushed the renovate/date-fns-4.x branch from e398b29 to 71f5947 Compare March 17, 2026 22:13
@renovate renovate Bot force-pushed the renovate/date-fns-4.x branch from 71f5947 to 7b2d6ce Compare April 1, 2026 22:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants