Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update dependency date-fns to v4 #4456

Closed
wants to merge 1 commit into from
Closed

Conversation

renovate[bot]
Copy link
Contributor

@renovate renovate bot commented Nov 28, 2024

This PR contains the following updates:

Package Change Age Adoption Passing Confidence
date-fns ^3.6.0 -> ^4.0.0 age adoption passing 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 these updates again.


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

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

Copy link

vercel bot commented Nov 28, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
saltdesignsystem ❌ Failed (Inspect) Dec 12, 2024 4:14pm

Copy link

changeset-bot bot commented Nov 28, 2024

⚠️ No Changeset found

Latest commit: 837389e

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@renovate renovate bot force-pushed the renovate/date-fns-4.x branch from 149aee9 to 562b81b Compare November 28, 2024 11:34
@renovate renovate bot force-pushed the renovate/date-fns-4.x branch from 562b81b to cec68b0 Compare November 29, 2024 09:44
@renovate renovate bot force-pushed the renovate/date-fns-4.x branch from cec68b0 to 68487a5 Compare November 29, 2024 11:42
@renovate renovate bot force-pushed the renovate/date-fns-4.x branch from 68487a5 to 263d0dd Compare November 29, 2024 13:44
@renovate renovate bot force-pushed the renovate/date-fns-4.x branch from 263d0dd to 2828f0b Compare November 29, 2024 16:50
@renovate renovate bot force-pushed the renovate/date-fns-4.x branch from 2828f0b to 6cc9724 Compare November 29, 2024 22:57
@renovate renovate bot force-pushed the renovate/date-fns-4.x branch from 6cc9724 to 0f7344a Compare December 5, 2024 16:03
@renovate renovate bot force-pushed the renovate/date-fns-4.x branch from 0f7344a to 6f0540e Compare December 5, 2024 23:05
@renovate renovate bot force-pushed the renovate/date-fns-4.x branch from 6f0540e to 16331ac Compare December 10, 2024 10:28
@renovate renovate bot force-pushed the renovate/date-fns-4.x branch from 16331ac to 8ff004b Compare December 10, 2024 11:24
@renovate renovate bot force-pushed the renovate/date-fns-4.x branch from 8ff004b to 7405d60 Compare December 10, 2024 12:29
@renovate renovate bot force-pushed the renovate/date-fns-4.x branch from 7405d60 to f7aaa9e Compare December 10, 2024 13:26
@renovate renovate bot force-pushed the renovate/date-fns-4.x branch from f7aaa9e to c01dd7a Compare December 10, 2024 17:38
@renovate renovate bot force-pushed the renovate/date-fns-4.x branch from c01dd7a to fcb6c5d Compare December 11, 2024 11:15
@joshwooding
Copy link
Contributor

@mark-tate This looks useful for date picker? Are you happy for us to move to it (will probably be easier as a non-renovate PR though)

Copy link
Contributor Author

renovate bot commented Dec 12, 2024

Renovate Ignore Notification

Because you closed this PR without merging, Renovate will ignore this update. You will not get PRs for any future 4.x releases. But if you manually upgrade to 4.x then Renovate will re-enable minor and patch updates automatically.

If you accidentally closed this PR, or if you changed your mind: rename this PR to get a fresh replacement PR.

@renovate renovate bot deleted the renovate/date-fns-4.x branch December 12, 2024 16:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant