From c9243bad41155d14b49cf37252216f2e79c2fcf4 Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Thu, 19 Sep 2024 11:00:45 -0400
Subject: [PATCH] Bump date-fns from 3.6.0 to 4.1.0 (#133)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Bumps [date-fns](https://github.com/date-fns/date-fns) from 3.6.0 to
4.1.0.
Sourced from date-fns's
releases. 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 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. Added time zones support via All relevant functions now accept the context startOfDay(addDays(Date.now(), 5, { in:
tz("Asia/Singapore") }));Release notes
v4.1.0
TZDate
to v1.0.2 as it includes
a bunch of critical bug fixes.Fixed
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
format
,
formatISO
, formatISO9075
,
formatRelative
and formatRFC3339
. See #3886.v4.0.0
Added
@date-fns/tz
's
TZDate
class and tz
helper function. See its
README for the details
about the API.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";
//=> "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.
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(),
... (truncated)
Sourced from date-fns's changelog.
v4.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 onnull
arguments. Whilenull
isn't allowed, the functions should rather returnInvalid Date
orNaN
in such cases. See #3885.Added
- Added missing time zone support to
format
,formatISO
,formatISO9075
,formatRelative
andformatRFC3339
. See #3886.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.
Added
Added time zones support via
@date-fns/tz
'sTZDate
class andtz
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
'sstart
andend
, 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
in
option or the first encountered argument object type. TheInterval
'sstart
andend
will be considered separately, starting fromstart
.In the given example, the result will be in the
TZDate
as the first argument is a number, and thestart
takes precedence over theend
.clamp(Date.now(), {
... (truncated)
313b902
Fix v4.1.0 change log entry26cd336
Promote to v4.1.097b53b9
Cover time zone edge cases59b7563
Add missing time zone support to format, formatISO, formatISO9075,
formatRela...0121164
Prevent constructFrom from throwing an error on nullbd87ef5
Update @date-fns/docs
99b4e67
Prepare v4.08df1706
Rewrite the time zones doce351977
Promote to v4.0.0-beta.18523656
Fix scripts/test/types.sh