[Snyk] Upgrade date-fns from 3.6.0 to 4.1.0 #23
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
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
- Fixed internal
- Added missing time zone support to
-
4.0.0 - 2024-09-16
-
-
import { addDays, startOfDay } from "date-fns";
-
-
-
- Fixed CDN build compatibility with jQuery and other tools that expose
-
4.0.0-beta.1 - 2024-09-14
-
4.0.0-alpha.1 - 2024-09-11
-
3.6.0 - 2024-03-18
- Fixed weeks in the Belarisuan locale's
- Added CDN versions of modules compatible with older browsers. See the CDN guide.
from date-fns GitHub release notesThis 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
TZDateto v1.0.2 as it includes a bunch of critical bug fixes.Fixed
constructFromthrowing an exception onnullarguments. Whilenullisn't allowed, the functions should rather returnInvalid DateorNaNin such cases. See #3885.Added
format,formatISO,formatISO9075,formatRelativeandformatRFC3339. 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
Added
Added time zones support via
@ date-fns/tz'sTZDateclass andtzhelper function. See its README for the details about the API.All relevant functions now accept the context
inoption, 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 { 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,
addDayswill get the current date and time in Singapore and add 5 days to it.startOfDaywill inherit the date type and return the start of the day in Singapore.Changed
The function arguments, as well as
Interval'sstartandend, now can be of different types, allowing you to mixUTCDate,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
inoption or the first encountered argument object type. TheInterval'sstartandendwill be considered separately, starting fromstart.In the given example, the result will be in the
TZDateas the first argument is a number, and thestarttakes precedence over theend.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
$by properly wrapping the code in an IIFE.On this release worked @ kossnocorp and @ world1dan. Also, thanks to @ seated for sponsoring me.
Fixed
formatDistance.Added
Important
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: