mittwald / cli

The mittwald command-line interface
https://developer.mittwald.de/cli
MIT License
7 stars 0 forks source link

chore(deps): bump date-fns from 3.6.0 to 4.0.0 #797

Closed dependabot[bot] closed 3 days ago

dependabot[bot] commented 3 days ago

Bumps date-fns from 3.6.0 to 4.0.0.

Release notes

Sourced from date-fns's releases.

v4.0.0

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.
Changelog

Sourced from date-fns's changelog.

v4.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 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.
Commits
  • 99b4e67 Prepare v4.0
  • 8df1706 Rewrite the time zones doc
  • e351977 Promote to v4.0.0-beta.1
  • 8523656 Fix scripts/test/types.sh
  • 38c2456 Update and "fix" ESLint complaints
  • f2f1cc6 Fix random build update issues
  • 8903389 Migrate to ESM-first, the fix CDN issue
  • 5274165 Update @​date-fns/docs
  • 3ae8737 Build the FP functions
  • a5fd87f Add a change log entry for v4 and release v4.0.0-alpha.1
  • Additional commits viewable in compare view


Dependabot compatibility score

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot show ignore conditions` will show all of the ignore conditions of the specified dependency - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)