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

[Snyk] Upgrade date-fns from 3.6.0 to 4.1.0 #23

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

nerdy-tech-com-gitub
Copy link
Owner

@nerdy-tech-com-gitub nerdy-tech-com-gitub commented Dec 8, 2024

snyk-top-banner

Snyk has created this PR to upgrade date-fns from 3.6.0 to 4.1.0.

ℹ️ Keep your dependencies up-to-date. This makes it easier to fix existing vulnerabilities and to more quickly identify and fix newly disclosed vulnerabilities when they affect your project.


⚠️ Warning: This PR contains major version upgrade(s), and may be a breaking change.

  • The recommended version is 4 versions ahead of your current version.

  • The recommended version was released on 3 months ago.

Release notes
Package name: date-fns
  • 4.1.0 - 2024-09-17

    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.
  • 4.0.0 - 2024-09-16

    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 run the type checker after the upgrade. If there are unfixable problems, please open an issue.

    • BREAKING: The package is now ESM-first. CommonJS is still supported, and it should not affect most users, but it might break in certain 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.
  • 4.0.0-beta.1 - 2024-09-14
  • 4.0.0-alpha.1 - 2024-09-11
  • 3.6.0 - 2024-03-18

    On this release worked @ kossnocorp and @ world1dan. Also, thanks to @ seated for sponsoring me.

    Fixed

    Added

from date-fns GitHub release notes

Important

  • Warning: This PR contains a major version upgrade, and may be a breaking change.
  • Check the changes in this PR to ensure they won't cause issues with your project.
  • This PR was automatically created by Snyk using the credentials of a real user.

Note: You are seeing this because you or someone else with access to this repository has authorized Snyk to open upgrade PRs.

For more information:

Summary by Sourcery

Build:

  • Upgrade date-fns dependency from version 3.6.0 to 4.1.0 in package.json.

Snyk has created this PR to upgrade date-fns from 3.6.0 to 4.1.0.

See this package in npm:
date-fns

See this project in Snyk:
https://app.snyk.io/org/nerds-github/project/ef708957-d107-4807-bb9b-ffb67ea15337?utm_source=github&utm_medium=referral&page=upgrade-pr
Copy link

sourcery-ai bot commented Dec 8, 2024

Reviewer's Guide by Sourcery

This PR upgrades the date-fns library from version 3.6.0 to 4.1.0. The upgrade introduces major changes including first-class time zone support, ESM-first packaging, and type system improvements. This is a major version upgrade that includes breaking changes primarily related to types and module system.

No diagrams generated as the changes look simple and do not need a visual representation.

File-Level Changes

Change Details Files
Major version upgrade of date-fns library with breaking changes
  • Upgraded from version 3.6.0 to 4.1.0
  • Package is now ESM-first (CommonJS still supported)
  • Added time zone support via TZDate class and tz helper function
  • Modified type system to allow mixing of different date types (UTCDate, TZDate, Date)
  • Added context 'in' option for timezone-aware calculations
dashboard/package.json

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time. You can also use
    this command to specify where the summary should be inserted.

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have skipped reviewing this pull request. Here's why:

  • It seems to have been created by a bot ('[Snyk]' found in title). We assume it knows what it's doing!
  • We don't review packaging changes - Let us know if you'd like us to change this.

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.

2 participants