All notable changes to this project will be documented in this file. This project adheres to Semantic Versioning.
This change log follows the format documented in Keep a CHANGELOG.
formatDistance
. (see the issue: #550; see the PR: #552)
Thanks to @giofilo!Hungarian locale (hu) (thanks to László Horváth @horvathlg)
Slovenian locale (sl) (thanks to Adam Stradovnik @Neoglyph)
Add step
to eachDay
function. Thanks to @BDav24.
See PR #487.
Fix accents on weekdays in the Italian locale. See PR #481. Thanks to @albertorestifo
Fix typo in ddd
format token in Spanish language locale.
Kudos to @fjaguero.
See PR #482
Fix DST border bug in addMilliseconds
, addSeconds
, addMinutes
, addHours
,
subMilliseconds
, subSeconds
, subMinutes
and subHours
.
See issue #465
Minor fix for Indonesian locale. Thanks to @bentinata. See PR: #458
All functions now convert all their arguments to the respective types. See PR: #443
Fixes for ordinals (1er, 2, 3, …) in French locale. Thanks to @fbonzon. See PR: #449
getTime
Bulgarian locale (bg) (thanks to Nikolay Stoynov @arvigeus)
Czech locale (cs) (thanks to David Rus @davidrus)
Auto generate TypeScript and flow typings from documentation on release. Thanks to @mattlewis92. See related PRs: #355, #370
Croatian locale (hr) (thanks to Matija Marohnić @silvenon)
Thai locale (th) (thanks to Athiwat Hirunworawongkun @athivvat)
Finnish locale (fi) (thanks to Pyry-Samuli Lahti @Pyppe)
isBefore
and isAfter
documentation mistakes.Filipino locale (fil) (thanks to Ian De La Cruz @RIanDeLaCruz)
Danish locale (da) (kudos to Anders B. Hansen @Andersbiha)
getOverlappingDaysInRanges
.Greek locale (el) (kudos to Theodoros Orfanidis @teoulas)
Slovak locale (sk) (kudos to Marek Suscak @mareksuscak)
Add yarn support. Thanks to Uladzimir Havenchyk @havenchyk. See PR: #288
Turkish locale (tr) (kudos to Alpcan Aydın @alpcanaydin)
Korean locale (ko) (thanks to Hong Chulju @angdev)
SS
and SSS
formats in format
are now correctly displayed with leading zeros.
Thanks to Paul Dijou @pauldijou.
See PR: #330Polish locale (pl) (thanks to Mateusz Derks @ertrzyiks)
Portuguese locale (pt) (thanks to Dário Freire @dfreire)
Swedish locale (sv) (thanks to Johannes Ulén @ejulen)
French locale (fr) (thanks to Jean Dupouy @izeau)
Performance tests. See PR: #289
Fix TypeScript and flow typings for isValid
.
See PR: #310
Fix incorrect locale tests that could potentially lead to format
bugs.
Kudos to Mateusz Derks @ertrzyiks.
See related PRs: #312,
#320
Minor language fixes in the documentation. Thanks to Vedad Šoše @vedadsose (#314) and Asia @asia-t (#318)
format
now returns String('Invalid Date')
if the passed date is invalid.
See PR: #323
distanceInWords
, distanceInWordsToNow
, distanceInWordsStrict
and format
functions now
check if the passed locale is valid, and fallback to English locale otherwise.
See PR: #321
Internal: use a loop instead of Object.keys
in buildFormattingTokensRegExp
to improve compatibility with older browsers.
See PR: #322
Italian locale (it) (thanks to Alberto Restifo @albertorestifo)
For German buildDistanceInWordsLocale
, add nominative case translations (for distances without a suffix).
Kudos to Asia @asia-t.
See related PR: #295
Indonesian locale (id) (thanks to Rahmat Budiharso @rbudiharso)
Catalan locale (ca) (thanks to Guillermo Grau @guigrpa)
Chinese Traditional locale (zh_tw) (thanks to tonypai @tpai).
Dutch language locale (nl) (kudos to Jorik Tangelder @jtangelder)
distanceInWordsStrict
to the list of supported functions in I18n doc.Bug in parse
when it sometimes parses ISO week-numbering dates incorrectly.
See PR: #262
Bug in some functions which caused them to handle dates earlier than 100 AD incorrectly. See PR: #263
distanceInWordsStrict
.
Kudos to @STRML.
See related PR: #254
TypeScript typings for all functions. Kudos to @mattlewis92. See related PR: #255
parse
now can parse dates that are ISO 8601 centuries (e.g., 19
and +0019
). var result = parse('19')
//=> Mon Jan 01 1900 00:00:00
parse
, added ability to specify the number of additional digits
for extended year or century format (possible values are 0, 1 or 2; default is 2). parse('+002016-11-01')
parse('+02016-11-01', {additionalDigits: 1})
parse('+2016-11-01', {additionalDigits: 0})
Japanese language locale (ja) (thanks to Thomas Eilmsteiner @DeMuu again!)
getISODay
setISODay
Incorrectly generated docs for format
.
Fixed typo in I18n doc.
YYYY
and YY
for years prior to 1000:
now format(new Date('0001-01-01'), 'YYYY-MM-DD')
returns 0001-01-01
instead of 1-01-01
.closestIndexTo
setDay
.Flow declarations for each function in the ".js.flow" style. Kudos to @JohnyDays. See related PRs:
format
now returns the correct result for key E
.
Prevent startOf...
, endOf...
and lastDayOf...
functions
to return dates with an incorrect time when the date is modifying
into another time zone.
parse
now parses years from 1 AD to 99 AD correctly.
Fix a bug in getISOWeek
appearing because of a changing time zone
(e.g., when the given date is in DST and the start of the ISO year is not).
require('date-fns/name_of_function')
or
import nameOfFunction from 'date-fns/name_of_function'
. // Before v1.0.0
var addMonths = require('date-fns/src/add_months')
// v1.0.0 onward
var addMonths = require('date-fns/add_months')
weekStartsAt
(i.e. endOfWeek
, isSameWeek
, lastDayOfWeek
, setDay
, startOfWeek
)
now instead receive the object options
with the property options.weekStartsOn
as the last argument. // Before v1.0.0
var result = endOfWeek(new Date(2014, 8, 2), 1)
// v1.0.0 onward
var result = endOfWeek(new Date(2014, 8, 2), {weekStartsOn: 1})
BREAKING: remove the function getTimeSinceMidnight
that was used inside
the other functions.
BREAKING: differenceInDays
now returns the number of full days instead
of calendar days.
BREAKING: eachDay
and isWithinRange
now throw an exception
when the given range boundaries are invalid.
Faster isLeapYear
.
Internal: make the documentation more verbose.
Internal: convert the tests from Chai to power-assert allowing them to run against IE8.
addISOYears
closestTo
differenceInCalendarDays
differenceInCalendarISOWeeks
differenceInCalendarISOYears
differenceInCalendarMonths
differenceInCalendarQuarters
differenceInCalendarWeeks
differenceInCalendarYears
differenceInHours
differenceInISOYears
differenceInMilliseconds
differenceInMinutes
differenceInMonths
differenceInQuarters
differenceInSeconds
differenceInWeeks
differenceInYears
distanceInWords
distanceInWordsToNow
endOfISOWeek
endOfISOYear
endOfToday
endOfTomorrow
endOfYesterday
getDaysInYear
isDate
isFriday
isMonday
isSameISOWeek
isSameISOYear
isSaturday
isSunday
isThisHour
isThisISOWeek
isThisISOYear
isThisMinute
isThisMonth
isThisQuarter
isThisSecond
isThisWeek
isThisYear
isThursday
isTomorrow
isTuesday
isValid
isWednesday
isYesterday
lastDayOfISOWeek
lastDayOfISOYear
startOfISOWeek
startOfToday
startOfTomorrow
startOfYesterday
subISOYears
Add Qo
, W
, Wo
, WW
, GG
, GGGG
, Z
, ZZ
, X
, x
keys to format
.
Fix a lot of bugs appearing when date is modifying into other time zone (e.g., when adding months and original date is in DST but new date is not).
Prevent instances of Date to lose milliseconds value when passed to.
parse
in IE10.
setISOWeek
now keeps time from original date.
Internal: reuse getDaysInMonth
inside of addMonths
.
differenceInDays
getTimeSinceMidnight
format
now has new format key aa
, which returns a.m.
/p.m.
as opposed to a
that returns am
/pm
.
Complete UMD package (for Bower and CDN).
Use parse
to clean date arguments in all functions.
parse
now fallbacks to new Date
when the argument
is not an ISO formatted date.
Internal: reuse getDaysInMonth
inside of setMonth
.
addQuarters
addWeeks
endOfQuarter
getDate
getDay
getDaysInMonth
getHours
getISOWeeksInYear
getMilliseconds
getMinutes
getMonth
getSeconds
getYear
isLeapYear
isSameHour
isSameMinute
isSameQuarter
isSameSecond
lastDayOfQuarter
lastDayOfWeek
max
min
setDate
setDay
setHours
setMilliseconds
setMinutes
setSeconds
startOfQuarter
subQuarters
subWeeks
format
now returns a.m.
/p.m.
instead of am
/pm
.
setMonth
now sets last day of month if original date was last day
of longer month.
Internal: Fix code style according to ESLint.
Internal: Make tests run through all time zones.
getQuarter
setQuarter
getDayOfYear
setDayOfYear
isPast
addSeconds
subSeconds
startOfSecond
endOfSecond
startOfMinute
endOfMinute
addMilliseconds
subMilliseconds
endOfYear
addYears
subYears
lastDayOfYear
lastDayOfMonth
format
now uses parse
to avoid time zone bugs.setIsoWeek
now sets time to the start of the day.format
now behaves correctly with 12:00 am.
format
now behaves correctly with ordinal numbers.
compareAsc
compareDesc
addHours
subHours
isSameDay
parse
getISOYear
setISOYear
startOfISOYear
getISOWeek
setISOWeek
addMonths
now correctly behaves with February
(see #18).format
function now behaves correctly with pm
/am
.addMinutes
subMinutes
isEqual
isBefore
isAfter
DDD
formatter.isSameYear
isWithinRange
format
startOfYear
isWeekend
isFuture
addDays
inside of subDays
.addMonths
subMonths
setMonth
setYear
isSameWeek
endOfMonth
.isFirstDayOfMonth
isLastDayOfMonth
isSameMonth
addDays
subDays
startOfWeek
endOfWeek
eachDay
startOfDay
now sets milliseconds as well.endOfDay
startOfMonth
endOfMonth
isToday
isWeekend
startOfDay