This repository has been archived by the owner on Sep 15, 2020. It is now read-only.
fix(deps): update dependency date-fns to v2 #20
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.
This PR contains the following updates:
^1.29.0
->^2.15.0
Release Notes
date-fns/date-fns
v2.15.0
Compare Source
Thanks to @belgamo, @Matsuuu, @Imballinst, @arsnyder16, @pankajupadhyay29, @DCBN, @leedriscoll, @gottsohn, @mukuljainx and @dtriana for working on the release. Also kudos to @KidkArolis, @imgx64, @fjc0k, @wmonk, @djD-REK, @dandv, @psimk and @brimworks for improving the documentation.
Fixed
addBusinessDays
when input date is a weekend day.parseISO
not returningInvalid Date
on incorrect string when there are spaces in it.es
round-tripping dates with Wednesday.d
/EEEE
ordering in tokens likePPPPP
.Changed
Added
fr-CH
locale.nl-BE
locale.gd
locale.en-NZ
locale.isMatch
function.v2.14.0
Compare Source
Kudos to @julamb, @JacobSoderblom, @justingrant, @dragunoff, @jmate0321, @gbhasha, @rasck, @AlbertoPdRF, @sebastianhaberey and @giogonzo for working on the release!
Fixed
add
,addDays
andaddMonths
.formatDistance
strings in the Hungarian locale.formatLong
in the Spanish locale.formatRelative
in the Italian locale.Added
eachQuarterOfInterval
.eu
) locale.en-IN
) locale.eachHourOfInterval
.v2.13.0
Compare Source
Thanks to @JorenVos, @developergouli, @rhlowe and @justingrant for working on the release!
Fixed
differenceInDays
DST behavior broken in 2.12.0.Added
formatISODuration
function.intervalToDuration
function.v2.12.0
Compare Source
Kudos to @leshakoss, @skyuplam, @so99ynoodles, @dkozickis, @belgamo, @akgondber, @dcousens and @BoomDev for working on the release!
Fixed
setDay
withweekStartsOn
!= 0.Added
formatDistanceToNowStrict
.v2.11.1
Compare Source
Fixed
v2.11.0
Compare Source
Kudos to @oakhan3, @Mukhammadali, @altrim, @leepowellcouk, @amatzon, @bryanMt, @kalekseev, @eugene-platov and @tjrobinson for working on the release.
Fixed
differenceInYears
causing incorrect results when the left date is a leap day.parseISO
to work correctly around time shift dates.format
to work correctly with GMT-0752/GMT-0456 and similar timezones.Changed
getDay
typings to return0|1|2|3|4|5|6
instead ofnumber
.ordinalNumber
function behavior.formatRelative
depending on if it's a current week or not.Added
uz
locale.mt
locale.v2.10.0
Compare Source
Fixed
formatISO
when formatting time with timezones with minute offsets > 0. Kudos to @dcRUSTy.Fixed
Added
weeks
toDuration
.weeks
support toadd
andsub
.throwProtectedError
.v2.9.0
Compare Source
Thanks to @mborgbrant, @saintplay, @mrenty, @kibertoad, @levibuzolic, @Anshuman71, @talgautb, @filipjuza, @tobyzerner, @emil9453, @fintara, @pascaliske, @rramiachraf, @marnusw and @Imballinst for working on the release.
Fixed
formatISO
.Added
eachMonthOfInterval
andeachYearOfInterval
.inclusive
option to `areIntervalsOverlapping.isExists
function that checks if the given date is exists.add
function to add seconds, minutes, hours, weeks, years in single call.sub
function, the opposite ofadd
.Duration
type used inadd
andsub
.Changed
Locale
type optional.Locale
type.Locale
type.parseJSON
.parseJSON
.v2.8.1
Compare Source
Thanks to @Imballinst for the bug fix!
Fixed
formatRFC3339
. See #1548.v2.8.0
Compare Source
Kudos to @NaridaL, @Zyten, @Imballinst, @leshakoss and @Neorth for working on the release.
Fixed
Added
formatISO
,formatISO9075
,formatRFC3339
, andformatRFC7231
functions.v2.7.0
Compare Source
Thanks to @mzgajner, @NaridaL, @Zyten, @leshakoss, @fintara, @kpr-hellofresh for contributing to the release.
Fixed
parseISO
in Firefox caused by differences ingetTimezoneOffset
.Changed
parseJSON
to accept strings without trailing 'Z' symbol and with up to 6 digits in the milliseconds' field.Added
v2.6.0
Compare Source
Kudos to @marnusw, @cdrikd and @rogyvoje for working on the release!
Added
parseJSON
- lightweight function (just 411 B) that parses dates formatted withtoJSON
.subBusinessDays
function.v2.5.1
Compare Source
Thanks to @mitchellbutler for the bug fix!
Fixed
addBusinessDays
.v2.5.0
Compare Source
Kudos to @dkozickis, @drugoi, @kranthilakum, @102, @gpetrioli and @JulienMalige for making the release happen.
Fixed
findIndex
from the code.Added
Interval
andLocale
types from Flow typings.v2.4.1
Compare Source
Thanks to @mrclayman for reporting the issue and @leshakoss for fixing it.
Fixed
v2.4.0
Compare Source
This release brought to you by these amazing people: @lovelovedokidoki, @alexigityan, @kalekseev and @andybangs. You rock!
Fixed
parseISO
.Added
v2.3.0
Compare Source
Huge thanks to @lovelovedokidoki who improved 8 (!) locales in an unstoppable open-source rampage and @VesterDe for fixing Slovenian locale 👏
Fixed
Added
v2.2.1
Compare Source
Kudos to date-fns contributors: @mzgajner, @sibiraj-s, @mukeshmandiwal, @SneakyFish5 and @CarterLi.
Added
set
function.\n
informat
,lightFormat
andparse
.v2.1.0
Compare Source
Thanks to date-fns contributors: @ManadayM, @illuminist, @visualfanatic, @vsaarinen and at least but not least @leshakoss!
Fixed
eachWeekendOfInterval
skipping the first date in the supplied interval.Added
v2.0.1
Compare Source
Fixed
getWeekOfMonth
withoptions.weekStartsOn
set to 1 not working for Sundays. Kudos to @waseemahmad31!v2.0.0
Compare Source
If you're upgrading from v2 alpha or beta, see the pre-release changelog.
Fixed
Fix the
toDate
bug occurring when parsing ISO-8601 style dates (but not valid ISO format)with a trailing Z (e.g
2012-01Z
), it returned Invalid Date for FireFox/IE11 #510Fix
differenceIn...
functions returning negative zero in some cases:#692
isDate
now works properly with dates passed across iframes #754.Fix a few bugs that appear in timezones with offsets that include seconds (e.g. GMT+00:57:44).
See PR #789.
Fixed DST issue. See #972 and #992 for more details.
Fixed DST issue in
eachDayOfInterval
that caused time in the daysafter DST change to have the shift as well.
Fix bug in Galician locale caused by incorrect usage of
getHours
instead of
getUTCHours
.Changed
BREAKING: now functions don't accept string arguments, but only
numbers or dates. When a string is passed, it will result in
an unexpected result (
Invalid Date
,NaN
, etc).From now on a string should be parsed using
parseISO
(ISO 8601)or
parse
.In v1 we've used
new Date()
to parse strings, but it resulted in manyhard-to-track bugs caused by inconsistencies in different browsers.
To address that we've implemented our ISO 8601 parser but that made
library to significantly grow in size. To prevent inevitable bugs
and keep the library tiny, we made this trade-off.
See this post for more details.
BREAKING: new format string API for
format
functionwhich is based on Unicode Technical Standard #35.
See this post for more details.
5129695
5129695
Characters are now escaped using single quote symbols (
'
) instead of square brackets.format
now throws RangeError if it encounters an unescaped latin characterthat isn't a valid formatting token.
To use
YY
andYYYY
tokens that represent week-numbering years,you should set
useAdditionalWeekYearTokens
option:To use
D
andDD
tokens which represent days of the year,set
useAdditionalDayOfYearTokens
option:BREAKING: function submodules now use camelCase naming schema:
BREAKING: min and max functions now accept an array of dates
rather than spread arguments.
BREAKING: make the second argument of
format
required for the sake of explicitness.BREAKING renamed ISO week-numbering year helpers:
addISOYears
→addISOWeekYears
differenceInCalendarISOYears
→differenceInCalendarISOWeekYears
differenceInISOYears
→differenceInISOWeekYears
endOfISOYear
→endOfISOWeekYear
getISOYear
→getISOWeekYear
isSameISOYear
→isSameISOWeekYear
lastDayOfISOYear
→lastDayOfISOWeekYear
setISOYear
→setISOWeekYear
subISOYears
→subISOWeekYears
i.e. "ISO year" renamed to "ISO week year", which is short for
ISO week-numbering year.
It makes them consistent with locale-dependent week-numbering year helpers,
e.g.,
startOfWeekYear
.BREAKING: functions renamed:
areRangesOverlapping
→areIntervalsOverlapping
eachDay
→eachDayOfInterval
getOverlappingDaysInRanges
→getOverlappingDaysInIntervals
isWithinRange
→isWithinInterval
This change was made to mirror the use of the word "interval" in standard ISO 8601:2004 terminology:
Also these functions now accept an object with
start
andend
propertiesinstead of two arguments as an interval. All these functions
throw
RangeError
if the start of the interval is after its endor if any date in the interval is
Invalid Date
.BREAKING: functions renamed:
distanceInWords
→formatDistance
distanceInWordsStrict
→formatDistanceStrict
distanceInWordsToNow
→formatDistanceToNow
to make them consistent with
format
andformatRelative
.BREAKING: The order of arguments of
distanceInWords
anddistanceInWordsStrict
is swapped to make them consistent with
differenceIn...
functions.BREAKING:
partialMethod
option informatDistanceStrict
is renamed toroundingMethod
.BREAKING: in
formatDistanceStrict
, ifroundingMethod
is not specified,it now defaults to
round
instead offloor
.BREAKING:
unit
option informatDistanceStrict
now accepts one of the strings:'second', 'minute', 'hour', 'day', 'month' or 'year' instead of 's', 'm', 'h', 'd', 'M' or 'Y'
BREAKING:
parse
that previously used to convert strings andnumbers to dates now parse only strings in an arbitrary format
specified as an argument. Use
toDate
to coerce numbers andparseISO
to parse ISO 8601 strings.
BREAKING:
toDate
(previouslyparse
) now doesn't accept stringarguments but only numbers and dates.
toDate
called with an invalidargument will return
Invalid Date
.BREAKING: new locale format.
See docs/Locale.
Locales renamed:
en
→en-US
zh_cn
→zh-CN
zh_tw
→zh-TW
BREAKING: now
closestTo
andclosestIndexTo
don't throw an exceptionwhen the second argument is not an array, and return Invalid Date instead.
BREAKING: now
isValid
doesn't throw an exceptionif the first argument is not an instance of Date.
Instead, argument is converted beforehand using
toDate
.Examples:
isValid
argumentnew Date()
true
true
new Date('2016-01-01')
true
true
new Date('')
false
false
new Date(1488370835081)
true
true
new Date(NaN)
false
false
'2016-01-01'
TypeError
false
''
TypeError
false
1488370835081
TypeError
true
NaN
TypeError
false
We introduce this change to make date-fns consistent with ECMAScript behavior
that try to coerce arguments to the expected type
(which is also the case with other date-fns functions).
BREAKING: functions now throw
RangeError
if optional values passed tooptions
are not
undefined
or have expected values.This change is introduced for consistency with ECMAScript standard library which does the same.
BREAKING:
format
,formatDistance
(previouslydistanceInWords
) andformatDistanceStrict
(previouslydistanceInWordsStrict
) now throwRangeError
if one the passed arguments is invalid. It reflects behavior oftoISOString
and Intl API. See #1032.BREAKING: all functions now implicitly convert arguments by following rules:
Notes:
Date
are converted toDate
using date-fns'toDate
function;toInteger
implementation(see #765);
String
function;Boolean
function.null
andundefined
passed to optional arguments (i.e. properties ofoptions
argument)are ignored as if no argument was passed.
If any resulting argument is invalid (i.e.
NaN
for numbers andInvalid Date
for dates),an invalid value will be returned:
false
for functions that return booleans (expectisValid
);Invalid Date
for functions that return dates;NaN
for functions that return numbers.See tests and PRs #460 and
#765 for exact behavior.
BREAKING: all functions now check if the passed number of arguments is less
than the number of required arguments and throw
TypeError
exception if so.BREAKING: all functions that accept numbers as arguments, now coerce
values using
Number()
and also round decimals. Positive decimals arerounded using
Math.floor
, decimals less than zero are rounded usingMath.ceil
.BREAKING: The Bower & UMD/CDN package versions are no longer supported.
BREAKING:
null
now is not a valid date.isValid(null)
returnsfalse
;toDate(null)
returns an invalid date. SincetoDate
is used internallyby all the functions, operations over
null
will also return an invalid date.See #537 for the reasoning.
toDate
(previouslyparse
) andisValid
functions now acceptany
typeas the first argument.
Exclude
docs.json
from the npm package. Kudos to @hawkrives.Added
Renovate configuration
📅 Schedule: At any time (no schedule defined).
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻️ Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.
This PR has been generated by WhiteSource Renovate. View repository job log here.