25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

CHANGELOG.md 76 KiB

3 년 전
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085
  1. # Change Log
  2. All notable changes to this project will be documented in this file.
  3. This project adheres to [Semantic Versioning].
  4. This change log follows the format documented in [Keep a CHANGELOG].
  5. [semantic versioning]: http://semver.org/
  6. [keep a changelog]: http://keepachangelog.com/
  7. ## [2.13.0] - 2020-05-06
  8. Thanks to [@JorenVos](https://github.com/JorenVos), [@developergouli](https://github.com/developergouli), [@rhlowe](https://github.com/rhlowe) and [@justingrant](http://github.com/justingrant) for working on the release!
  9. ### Fixed
  10. - [Fixed mei abbreviation in the Dutch locale](https://github.com/date-fns/date-fns/pull/1752).
  11. - [Fixed `differenceInDays` DST behavior broken in 2.12.0](https://github.com/date-fns/date-fns/pull/1754).
  12. ### Added
  13. - [Added Kannada locale support](https://github.com/date-fns/date-fns/pull/1747).
  14. - [Added `formatISODuration` function](https://github.com/date-fns/date-fns/pull/1713).
  15. - [Added `intervalToDuration` function](https://github.com/date-fns/date-fns/pull/1713).
  16. ## [2.12.0] - 2020-04-09
  17. Kudos to [@leshakoss](http://github.com/leshakoss), [@skyuplam](https://github.com/skyuplam), [@so99ynoodles](https://github.com/so99ynoodles), [@dkozickis](https://github.com/dkozickis), [@belgamo](https://github.com/belgamo), [@akgondber](https://github.com/akgondber), [@dcousens](https://github.com/dcousens) and [@BoomDev](https://github.com/BoomDev) for working on the release!
  18. ### Fixed
  19. - [Fixed minulý štvrtok in Slovak locale](https://github.com/date-fns/date-fns/pull/1701).
  20. - Fixed date ordinalNumber for [ja/zh-CN/zh-TW](https://github.com/date-fns/date-fns/pull/1690) and [ko](https://github.com/date-fns/date-fns/pull/1696).
  21. - [Fixed quarters parsing](https://github.com/date-fns/date-fns/pull/1694).
  22. - [Fixed `setDay` with `weekStartsOn` != 0](https://github.com/date-fns/date-fns/pull/1639).
  23. - [Fixed differenceInDays across DST](https://github.com/date-fns/date-fns/pull/1630).
  24. - [Fixed required arguments exception message](https://github.com/date-fns/date-fns/pull/1674).
  25. ### Added
  26. - [Added new function `formatDistanceToNowStrict`](https://github.com/date-fns/date-fns/pull/1679).
  27. ## [2.11.1] - 2020-03-26
  28. ### Fixed
  29. - Rebuilt TypeScript and flow types.
  30. ## [2.11.0] - 2020-03-13
  31. Kudos to [@oakhan3](https://github.com/oakhan3), [@Mukhammadali](https://github.com/Mukhammadali), [@altrim](https://github.com/altrim), [@leepowellcouk](https://github.com/leepowellcouk), [@amatzon](@https://github.com/amatzon), [@bryanMt](https://github.com/bryanMt), [@kalekseev](https://github.com/kalekseev), [@eugene-platov](https://github.com/eugene-platov) and [@tjrobinson](https://github.com/tjrobinson) for working on the release.
  32. ### Fixed
  33. - [Fixed a bug in `differenceInYears` causing incorrect results when the left date is a leap day](https://github.com/date-fns/date-fns/pull/1654).
  34. - [Fixed `parseISO` to work correctly around time shift dates](https://github.com/date-fns/date-fns/pull/1667).
  35. - [Fixed `format` to work correctly with GMT-0752/GMT-0456 and similar timezones](https://github.com/date-fns/date-fns/pull/1666).
  36. ### Changed
  37. - [Changed `getDay` typings to return `0|1|2|3|4|5|6` instead of `number`](https://github.com/date-fns/date-fns/pull/1668).
  38. - [Improved Chinese locale](https://github.com/date-fns/date-fns/pull/1664):
  39. - Change date format to meet the national standard (GB/T 7408-2005).
  40. - Improve `ordinalNumber` function behavior.
  41. - Add prefix in `formatRelative` depending on if it's a current week or not.
  42. ### Added
  43. - [Added Uzbek `uz` locale](https://github.com/date-fns/date-fns/pull/1648).
  44. - [Updated Macedonian locale for v2](https://github.com/date-fns/date-fns/pull/1649).
  45. - [Added Maltese `mt` locale](https://github.com/date-fns/date-fns/pull/1658).
  46. ## [2.10.0] - 2020-02-25
  47. ### Fixed
  48. - [Fixed `formatISO` when formatting time with timezones with minute offsets > 0](https://github.com/date-fns/date-fns/pull/1599). Kudos to [@dcRUSTy](https://github.com/dcRUSTy).
  49. ### Fixed
  50. - Fixed a bug in setDay when using weekStartsOn that is not 0
  51. ### Added
  52. - [Added `weeks` to `Duration`](https://github.com/date-fns/date-fns/pull/1592).
  53. - [Added `weeks` support to `add` and `sub`](https://github.com/date-fns/date-fns/pull/1592).
  54. ## [2.9.0] - 2020-01-08
  55. Thanks to [@mborgbrant](https://github.com/mborgbrant), [@saintplay](https://github.com/saintplay), [@mrenty](https://github.com/mrenty), [@kibertoad](https://github.com/kibertoad), [@levibuzolic](https://github.com/levibuzolic), [@Anshuman71](https://github.com/Anshuman71), [@talgautb](https://github.com/talgautb), [@filipjuza](https://github.com/filipjuza), [@tobyzerner](https://github.com/tobyzerner), [@emil9453](https://github.com/emil9453), [@fintara](https://github.com/fintara), [@pascaliske](https://github.com/pascaliske), [@rramiachraf](https://github.com/rramiachraf), [@marnusw](https://github.com/marnusw) and [@Imballinst](https://github.com/Imballinst) for working on the release.
  56. ### Fixed
  57. - [Fixed a bug with addBusinessDays returning the Tuesday when adding 1 day on weekends. Now it returns the Monday](https://github.com/date-fns/date-fns/pull/1588).
  58. - [Added missing timezone to `formatISO`](https://github.com/date-fns/date-fns/pull/1576).
  59. - [Removed dots from short day period names in the Kazakh locale](https://github.com/date-fns/date-fns/pull/1512).
  60. - [Fixed typo in formatDistance in the Czech locale](https://github.com/date-fns/date-fns/pull/1540).
  61. - [Fixed shortenings in the Bulgarian locale](https://github.com/date-fns/date-fns/pull/1560).
  62. - [Fixed regex for the May in the Portuguese locale](https://github.com/date-fns/date-fns/pull/1565).
  63. ### Added
  64. - [Added `eachMonthOfInterval` and `eachYearOfInterval`](https://github.com/date-fns/date-fns/pull/618).
  65. - [Added `inclusive` option to `areIntervalsOverlapping](https://github.com/date-fns/date-fns/pull/643).
  66. - [Added `isExists` function that checks if the given date is exists](https://github.com/date-fns/date-fns/pull/682).
  67. - [Added `add` function to add seconds, minutes, hours, weeks, years in single call](https://github.com/date-fns/date-fns/pull/1581).
  68. - [Added `sub` function, the opposite of `add`](https://github.com/date-fns/date-fns/pull/1583).
  69. - [Added `Duration` type used in `add` and `sub`](https://github.com/date-fns/date-fns/pull/1583).
  70. - [Added Azerbaijani (az) locale](https://github.com/date-fns/date-fns/pull/1547).
  71. - [Added Moroccan Arabic (ar-MA) locale](https://github.com/date-fns/date-fns/pull/1578).
  72. ### Changed
  73. - [Reduced the total minified build size by 1Kb/4%](https://github.com/date-fns/date-fns/pull/1563).
  74. - [Made all properties in `Locale` type optional](https://github.com/date-fns/date-fns/pull/1542).
  75. - [Added missing properties to `Locale` type](https://github.com/date-fns/date-fns/pull/1542).
  76. - [Add the locale code to `Locale` type](https://github.com/date-fns/date-fns/pull/1580).
  77. - [Added support of space time separator to `parseJSON`](https://github.com/date-fns/date-fns/pull/1579).
  78. - [Allowed up to 7 digits in milliseconds in `parseJSON`](https://github.com/date-fns/date-fns/pull/1579).
  79. ## [2.8.1] - 2019-11-22
  80. Thanks to [@Imballinst](https://github.com/Imballinst) for the bug fix!
  81. ### Fixed
  82. - [Add colon between the hour and minutes for `formatRFC3339`](https://github.com/date-fns/date-fns/pull/1549). [See #1548](https://github.com/date-fns/date-fns/issues/1548).
  83. ## [2.8.0] - 2019-11-19
  84. Kudos to [@NaridaL](https://github.com/NaridaL), [@Zyten](https://github.com/Zyten), [@Imballinst](https://github.com/Imballinst), [@leshakoss](https://github.com/leshakoss) and [@Neorth](https://github.com/Neorth) for working on the release.
  85. ### Fixed
  86. - [Remove the next week preposition in the Swedish locale](https://github.com/date-fns/date-fns/pull/1538).
  87. ### Added
  88. - [Added Malay (ms) locale](https://github.com/date-fns/date-fns/pull/1537).
  89. - [Added `formatISO`, `formatISO9075`, `formatRFC3339`, and `formatRFC7231` functions](https://github.com/date-fns/date-fns/pull/1536).
  90. ## [2.7.0] - 2019-11-07
  91. Thanks to [@mzgajner](https://github.com/mzgajner), [@NaridaL](https://github.com/NaridaL), [@Zyten](https://github.com/Zyten), [@leshakoss](https://github.com/leshakoss), [@fintara](https://github.com/fintara), [@kpr-hellofresh](https://github.com/kpr-hellofresh) for contributing to the release.
  92. ### Fixed
  93. - [Fixed a mistake in the Slovenian locale](https://github.com/date-fns/date-fns/pull/1529).
  94. - [Fixed incorrect behavior of `parseISO` in Firefox caused by differences in `getTimezoneOffset`](https://github.com/date-fns/date-fns/pull/1495).
  95. ### Changed
  96. - [Make object arguments types more elaborate in Flow type definitions](https://github.com/date-fns/date-fns/pull/1519).
  97. - [Get rid of deprecated Function in Flow type definitions](https://github.com/date-fns/date-fns/pull/1520).
  98. - [Allow `parseJSON` to accept strings without trailing 'Z' symbol and with up to 6 digits in the milliseconds' field](https://github.com/date-fns/date-fns/pull/1499).
  99. ### Added
  100. - [Added Bulgarian (bg) locale](https://github.com/date-fns/date-fns/pull/1522).
  101. ## [2.6.0] - 2019-10-22
  102. Kudos to [@marnusw](https://github.com/marnusw), [@cdrikd](https://github.com/cdrikd) and [@rogyvoje](https://github.com/rogyvoje) for working on the release!
  103. ### Added
  104. - [Added `parseJSON` - lightweight function (just 411 B) that parses dates formatted with `toJSON`](https://github.com/date-fns/date-fns/pull/1463).
  105. - [Added the language code to each locale](https://github.com/date-fns/date-fns/pull/1489).
  106. - [Added `subBusinessDays` function](https://github.com/date-fns/date-fns/pull/1491).
  107. - [Added both Serbian - cyrillic (sr) and latin (sr-Latn) locales](https://github.com/date-fns/date-fns/pull/1494).
  108. ## [2.5.1] - 2019-10-18
  109. Thanks to [@mitchellbutler](https://github.com/mitchellbutler) for the bug fix!
  110. ### Fixed
  111. - [Fixed infinite loop in `addBusinessDays`](https://github.com/date-fns/date-fns/pull/1486).
  112. ## [2.5.0] - 2019-10-16
  113. Kudos to [@dkozickis](https://github.com/dkozickis), [@drugoi](https://github.com/drugoi), [@kranthilakum](https://github.com/kranthilakum), [@102](https://github.com/102), [@gpetrioli](https://github.com/gpetrioli) and [@JulienMalige](https://github.com/JulienMalige) for making the release happen.
  114. ### Fixed
  115. - [Fixed compatibility with IE11 by removing `findIndex` from the code](https://github.com/date-fns/date-fns/pull/1457).
  116. - [Fixed Greek locale patterns](https://github.com/date-fns/date-fns/pull/1480).
  117. ### Added
  118. - [Added Kazakh (kk) locale](https://github.com/date-fns/date-fns/pull/1460).
  119. - [Added Telugu (te) locale](https://github.com/date-fns/date-fns/pull/1464).
  120. - [Added Canadian French (fr-CA) locale](https://github.com/date-fns/date-fns/issues/1465).
  121. - [Added Australian English (en-AU) locale](https://github.com/date-fns/date-fns/pull/1470).
  122. - [Exported `Interval` and `Locale` types from Flow typings](https://github.com/date-fns/date-fns/pull/1475).
  123. ## [2.4.1] - 2019-09-28
  124. Thanks to [@mrclayman](https://github.com/mrclayman) for reporting the issue and [@leshakoss](https://github.com/leshakoss) for fixing it.
  125. ### Fixed
  126. - [Fixed am/pm mixup in the Czech locale](https://github.com/date-fns/date-fns/pull/1453).
  127. ## [2.4.0] - 2019-09-27
  128. This release brought to you by these amazing people: [@lovelovedokidoki](https://github.com/lovelovedokidoki), [@alexigityan](https://github.com/alexigityan), [@kalekseev](https://github.com/kalekseev) and [@andybangs](https://github.com/andybangs). You rock!
  129. ### Fixed
  130. - [Fixed Vietnamese parsing patterns](https://github.com/date-fns/date-fns/pull/1445).
  131. - [Fixed Czech parsing regexes](https://github.com/date-fns/date-fns/pull/1446).
  132. - [Fixed offset for Eastern Hemisphere in `parseISO`](https://github.com/date-fns/date-fns/pull/1450).
  133. ### Added
  134. - [Added Armenian locale support](https://github.com/date-fns/date-fns/pull/1448).
  135. ## [2.3.0] - 2019-09-24
  136. Huge thanks to [@lovelovedokidoki](https://github.com/lovelovedokidoki) who improved 8 (!) locales in an unstoppable open-source rampage and [@VesterDe](https://github.com/VesterDe) for fixing Slovenian locale 👏
  137. ### Fixed
  138. - [Fixed the translation of "yesterday" in the Slovenian locale](https://github.com/date-fns/date-fns/pull/1420).
  139. - [Fixed French parsing issues with June and August](https://github.com/date-fns/date-fns/pull/1430).
  140. - [Improved Turkish parsing](https://github.com/date-fns/date-fns/pull/1432).
  141. - [Fixed "March" in Dutch parsing patterns](https://github.com/date-fns/date-fns/pull/1433).
  142. - [Fixed Hindi parsing patterns](https://github.com/date-fns/date-fns/pull/1434).
  143. ### Added
  144. - [Added Finnish matching patterns](https://github.com/date-fns/date-fns/pull/1425).
  145. - [Accept abbreviated March, June, July in Norwegian locales](https://github.com/date-fns/date-fns/pull/1431).
  146. - [Added parsing for Greek months with long formatting](https://github.com/date-fns/date-fns/pull/1435).
  147. ## [2.2.1] - 2019-09-12
  148. Kudos to date-fns contributors: [@mzgajner](https://github.com/mzgajner), [@sibiraj-s](https://github.com/sibiraj-s), [@mukeshmandiwal](https://github.com/mukeshmandiwal), [@SneakyFish5](https://github.com/SneakyFish5) and [@CarterLi](https://github.com/CarterLi).
  149. ### Added
  150. - [Added new `set` function](https://github.com/date-fns/date-fns/pull/1398).
  151. - [Updated Slovenian (sl) locale for v2](https://github.com/date-fns/date-fns/pull/1418).
  152. - [Added Tamil (ta) locale](https://github.com/date-fns/date-fns/pull/1411).
  153. - [Added Hindi (hi) locale](https://github.com/date-fns/date-fns/pull/1409).
  154. - [Added support of `\n` in `format`, `lightFormat` and `parse`](https://github.com/date-fns/date-fns/pull/1417).
  155. ## [2.1.0] - 2019-09-06
  156. Thanks to date-fns contributors: [@ManadayM](https://github.com/ManadayM), [@illuminist](https://github.com/illuminist), [@visualfanatic](https://github.com/visualfanatic), [@vsaarinen](https://github.com/vsaarinen) and at least but not least [@leshakoss](https://github.com/leshakoss)!
  157. ### Fixed
  158. - [Set start of the week to the Sunday for Thai locale](https://github.com/date-fns/date-fns/pull/1402).
  159. - [Fixed month matching in Polish locale](https://github.com/date-fns/date-fns/pull/1404).
  160. - [Fixed `eachWeekendOfInterval` skipping the first date in the supplied interval](https://github.com/date-fns/date-fns/pull/1407).
  161. ### Added
  162. - [Added Gujarati locale](https://github.com/date-fns/date-fns/pull/1400).
  163. ## [2.0.1] - 2019-08-23
  164. ### Fixed
  165. - [Fix](https://github.com/date-fns/date-fns/pull/1046) `getWeekOfMonth` with `options.weekStartsOn` set to 1 [not working for Sundays](https://github.com/date-fns/date-fns/issues/1040). Kudos to [@waseemahmad31](https://github.com/waseemahmad31)!
  166. ## [2.0.0] - 2019-08-20
  167. If you're upgrading from v2 alpha or beta, [see the pre-release changelog](https://gist.github.com/kossnocorp/a307a464760b405bb78ef5020a4ab136).
  168. ### Fixed
  169. - Fix the `toDate` bug occurring when parsing ISO-8601 style dates (but not valid ISO format)
  170. with a trailing Z (e.g `2012-01Z`), it returned Invalid Date for FireFox/IE11 [#510](https://github.com/date-fns/date-fns/issue/510)
  171. - Fix `differenceIn...` functions returning negative zero in some cases:
  172. [#692](https://github.com/date-fns/date-fns/issues/692)
  173. - `isDate` now works properly with dates passed across iframes [#754](https://github.com/date-fns/date-fns/pull/754).
  174. - Fix a few bugs that appear in timezones with offsets that include seconds (e.g. GMT+00:57:44).
  175. See PR [#789](https://github.com/date-fns/date-fns/pull/789).
  176. - [Fixed DST issue](https://github.com/date-fns/date-fns/pull/1003). See [#972](https://github.com/date-fns/date-fns/issues/972) and [#992](https://github.com/date-fns/date-fns/issues/992) for more details.
  177. - Fixed DST issue in `eachDayOfInterval` that caused time in the days
  178. after DST change to have the shift as well.
  179. - Fix bug in Galician locale caused by incorrect usage of `getHours`
  180. instead of `getUTCHours`.
  181. ### Changed
  182. - **BREAKING**: now functions don't accept string arguments, but only
  183. numbers or dates. When a string is passed, it will result in
  184. an unexpected result (`Invalid Date`, `NaN`, etc).
  185. From now on a string should be parsed using `parseISO` (ISO 8601)
  186. or `parse`.
  187. In v1 we've used `new Date()` to parse strings, but it resulted in many
  188. hard-to-track bugs caused by inconsistencies in different browsers.
  189. To address that we've implemented our ISO 8601 parser but that made
  190. library to significantly grow in size. To prevent inevitable bugs
  191. and keep the library tiny, we made this trade-off.
  192. See [this post](https://blog.date-fns.org/post/we-cut-date-fns-v2-minimal-build-size-down-to-300-bytes-and-now-its-the-smallest-date-library-18f2nvh2z0yal) for more details.
  193. ```javascript
  194. // Before v2.0.0
  195. addDays('2016-01-01', 1)
  196. // v2.0.0 onward
  197. addDays(parseISO('2016-01-01'), 1)
  198. ```
  199. - **BREAKING**: new format string API for `format` function
  200. which is based on [Unicode Technical Standard #35](https://www.unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table).
  201. See [this post](https://blog.date-fns.org/post/unicode-tokens-in-date-fns-v2-sreatyki91jg) for more details.
  202. | Unit | v2 Pattern | v1 Pattern | Result examples |
  203. | ------------------------------- | ---------- | ---------- | --------------------------------- |
  204. | Era | G..GGG | | AD, BC |
  205. | | GGGG | | Anno Domini, Before Christ |
  206. | | GGGGG | | A, B |
  207. | Calendar year | y | | 44, 1, 1900, 2017 |
  208. | | yo | | 44th, 1st, 0th, 17th |
  209. | | yy | YY | 44, 01, 00, 17 |
  210. | | yyy | | 044, 001, 1900, 2017 |
  211. | | yyyy | YYYY | 0044, 0001, 1900, 2017 |
  212. | | yyyyy | | ... |
  213. | Local week-numbering year | Y | | 44, 1, 1900, 2017 |
  214. | | Yo | | 44th, 1st, 1900th, 2017th |
  215. | | YY | | 44, 01, 00, 17 |
  216. | | YYY | | 044, 001, 1900, 2017 |
  217. | | YYYY | | 0044, 0001, 1900, 2017 |
  218. | | YYYYY | | ... |
  219. | ISO week-numbering year | R | | -43, 0, 1, 1900, 2017 |
  220. | | RR | GG | -43, 00, 01, 1900, 2017 |
  221. | | RRR | | -043, 000, 001, 1900, 2017 |
  222. | | RRRR | GGGG | -0043, 0000, 0001, 1900, 2017 |
  223. | | RRRRR | | ... |
  224. | Extended year | u | | -43, 0, 1, 1900, 2017 |
  225. | | uu | | -43, 01, 1900, 2017 |
  226. | | uuu | | -043, 001, 1900, 2017 |
  227. | | uuuu | | -0043, 0001, 1900, 2017 |
  228. | | uuuuu | | ... |
  229. | Quarter (formatting) | Q | | 1, 2, 3, 4 |
  230. | | Qo | | 1st, 2nd, 3rd, 4th |
  231. | | QQ | | 01, 02, 03, 04 |
  232. | | QQQ | | Q1, Q2, Q3, Q4 |
  233. | | QQQQ | | 1st quarter, 2nd quarter, ... |
  234. | | QQQQQ | | 1, 2, 3, 4 |
  235. | Quarter (stand-alone) | q | Q | 1, 2, 3, 4 |
  236. | | qo | Qo | 1st, 2nd, 3rd, 4th |
  237. | | qq | | 01, 02, 03, 04 |
  238. | | qqq | | Q1, Q2, Q3, Q4 |
  239. | | qqqq | | 1st quarter, 2nd quarter, ... |
  240. | | qqqqq | | 1, 2, 3, 4 |
  241. | Month (formatting) | M | | 1, 2, ..., 12 |
  242. | | Mo | | 1st, 2nd, ..., 12th |
  243. | | MM | | 01, 02, ..., 12 |
  244. | | MMM | | Jan, Feb, ..., Dec |
  245. | | MMMM | | January, February, ..., December |
  246. | | MMMMM | | J, F, ..., D |
  247. | Month (stand-alone) | L | M | 1, 2, ..., 12 |
  248. | | Lo | | 1st, 2nd, ..., 12th |
  249. | | LL | MM | 01, 02, ..., 12 |
  250. | | LLL | MMM | Jan, Feb, ..., Dec |
  251. | | LLLL | MMMM | January, February, ..., December |
  252. | | LLLLL | | J, F, ..., D |
  253. | Local week of year | w | | 1, 2, ..., 53 |
  254. | | wo | | 1st, 2nd, ..., 53th |
  255. | | ww | | 01, 02, ..., 53 |
  256. | ISO week of year | I | W | 1, 2, ..., 53 |
  257. | | Io | Wo | 1st, 2nd, ..., 53th |
  258. | | II | WW | 01, 02, ..., 53 |
  259. | Day of month | d | D | 1, 2, ..., 31 |
  260. | | do | Do | 1st, 2nd, ..., 31st |
  261. | | dd | DD | 01, 02, ..., 31 |
  262. | Day of year | D | DDD | 1, 2, ..., 365, 366 |
  263. | | Do | DDDo | 1st, 2nd, ..., 365th, 366th |
  264. | | DD | | 01, 02, ..., 365, 366 |
  265. | | DDD | DDDD | 001, 002, ..., 365, 366 |
  266. | | DDDD | | ... |
  267. | Day of week (formatting) | E..EEE | | Mon, Tue, Wed, ..., Su |
  268. | | EEEE | | Monday, Tuesday, ..., Sunday |
  269. | | EEEEE | | M, T, W, T, F, S, S |
  270. | | EEEEEE | | Mo, Tu, We, Th, Fr, Su, Sa |
  271. | ISO day of week (formatting) | i | E | 1, 2, 3, ..., 7 |
  272. | | io | do | 1st, 2nd, ..., 7th |
  273. | | ii | | 01, 02, ..., 07 |
  274. | | iii | ddd | Mon, Tue, Wed, ..., Su |
  275. | | iiii | dddd | Monday, Tuesday, ..., Sunday |
  276. | | iiiii | | M, T, W, T, F, S, S |
  277. | | iiiiii | dd | Mo, Tu, We, Th, Fr, Su, Sa |
  278. | Local day of week (formatting) | e | | 2, 3, 4, ..., 1 |
  279. | | eo | | 2nd, 3rd, ..., 1st |
  280. | | ee | | 02, 03, ..., 01 |
  281. | | eee | | Mon, Tue, Wed, ..., Su |
  282. | | eeee | | Monday, Tuesday, ..., Sunday |
  283. | | eeeee | | M, T, W, T, F, S, S |
  284. | | eeeeee | | Mo, Tu, We, Th, Fr, Su, Sa |
  285. | Local day of week (stand-alone) | c | | 2, 3, 4, ..., 1 |
  286. | | co | | 2nd, 3rd, ..., 1st |
  287. | | cc | | 02, 03, ..., 01 |
  288. | | ccc | | Mon, Tue, Wed, ..., Su |
  289. | | cccc | | Monday, Tuesday, ..., Sunday |
  290. | | ccccc | | M, T, W, T, F, S, S |
  291. | | cccccc | | Mo, Tu, We, Th, Fr, Su, Sa |
  292. | AM, PM | a..aaa | A | AM, PM |
  293. | | aaaa | aa | a.m., p.m. |
  294. | | aaaaa | | a, p |
  295. | AM, PM, noon, midnight | b..bbb | | AM, PM, noon, midnight |
  296. | | bbbb | | a.m., p.m., noon, midnight |
  297. | | bbbbb | | a, p, n, mi |
  298. | Flexible day period | B..BBB | | at night, in the morning, ... |
  299. | | BBBB | | at night, in the morning, ... |
  300. | | BBBBB | | at night, in the morning, ... |
  301. | Hour [1-12] | h | | 1, 2, ..., 11, 12 |
  302. | | ho | | 1st, 2nd, ..., 11th, 12th |
  303. | | hh | | 01, 02, ..., 11, 12 |
  304. | Hour [0-23] | H | | 0, 1, 2, ..., 23 |
  305. | | Ho | | 0th, 1st, 2nd, ..., 23rd |
  306. | | HH | | 00, 01, 02, ..., 23 |
  307. | Hour [0-11] | K | | 1, 2, ..., 11, 0 |
  308. | | Ko | | 1st, 2nd, ..., 11th, 0th |
  309. | | KK | | 1, 2, ..., 11, 0 |
  310. | Hour [1-24] | k | | 24, 1, 2, ..., 23 |
  311. | | ko | | 24th, 1st, 2nd, ..., 23rd |
  312. | | kk | | 24, 01, 02, ..., 23 |
  313. | Minute | m | | 0, 1, ..., 59 |
  314. | | mo | | 0th, 1st, ..., 59th |
  315. | | mm | | 00, 01, ..., 59 |
  316. | Second | s | | 0, 1, ..., 59 |
  317. | | so | | 0th, 1st, ..., 59th |
  318. | | ss | | 00, 01, ..., 59 |
  319. | Fraction of second | S | | 0, 1, ..., 9 |
  320. | | SS | | 00, 01, ..., 99 |
  321. | | SSS | | 000, 0001, ..., 999 |
  322. | | SSSS | | ... |
  323. | Timezone (ISO-8601 w/ Z) | X | | -08, +0530, Z |
  324. | | XX | | -0800, +0530, Z |
  325. | | XXX | | -08:00, +05:30, Z |
  326. | | XXXX | | -0800, +0530, Z, +123456 |
  327. | | XXXXX | | -08:00, +05:30, Z, +12:34:56 |
  328. | Timezone (ISO-8601 w/o Z) | x | | -08, +0530, +00 |
  329. | | xx | ZZ | -0800, +0530, +0000 |
  330. | | xxx | Z | -08:00, +05:30, +00:00 |
  331. | | xxxx | | -0800, +0530, +0000, +123456 |
  332. | | xxxxx | | -08:00, +05:30, +00:00, +12:34:56 |
  333. | Timezone (GMT) | O...OOO | | GMT-8, GMT+5:30, GMT+0 |
  334. | | OOOO | | GMT-08:00, GMT+05:30, GMT+00:00 |
  335. | Timezone (specific non-locat.) | z...zzz | | GMT-8, GMT+5:30, GMT+0 |
  336. | | zzzz | | GMT-08:00, GMT+05:30, GMT+00:00 |
  337. | Seconds timestamp | t | X | 512969520 |
  338. | | tt | | ... |
  339. | Milliseconds timestamp | T | x | 512969520900 |
  340. | | TT | | ... |
  341. | Long localized date | P | | 5/29/53 |
  342. | | PP | | May 29, 1453 |
  343. | | PPP | | May 29th, 1453 |
  344. | | PPPP | | Sunday, May 29th, 1453 |
  345. | Long localized time | p | | 12:00 AM |
  346. | | pp | | 12:00:00 AM |
  347. | | ppp | | 12:00:00 AM GMT+2 |
  348. | | pppp | | 12:00:00 AM GMT+02:00 |
  349. | Combination of date and time | Pp | | 5/29/53, 12:00 AM |
  350. | | PPpp | | May 29, 1453, 12:00 AM |
  351. | | PPPppp | | May 29th, 1453 at ... |
  352. | | PPPPpppp | | Sunday, May 29th, 1453 at ... |
  353. Characters are now escaped using single quote symbols (`'`) instead of square brackets.
  354. `format` now throws RangeError if it encounters an unescaped latin character
  355. that isn't a valid formatting token.
  356. To use `YY` and `YYYY` tokens that represent week-numbering years,
  357. you should set `useAdditionalWeekYearTokens` option:
  358. ```javascript
  359. format(Date.now(), 'YY', { useAdditionalWeekYearTokens: true })
  360. //=> '86'
  361. ```
  362. To use `D` and `DD` tokens which represent days of the year,
  363. set `useAdditionalDayOfYearTokens` option:
  364. ```javascript
  365. format(Date.now(), 'D', { useAdditionalDayOfYearTokens: true })
  366. //=> '364'
  367. ```
  368. - **BREAKING**: function submodules now use camelCase naming schema:
  369. ```javascript
  370. // Before v2.0.0
  371. import differenceInCalendarISOYears from 'date-fns/difference_in_calendar_iso_years'
  372. // v2.0.0 onward
  373. import differenceInCalendarISOYears from 'date-fns/differenceInCalendarISOYears'
  374. ```
  375. - **BREAKING**: min and max functions now accept an array of dates
  376. rather than spread arguments.
  377. ```javascript
  378. // Before v2.0.0
  379. var date1 = new Date(1989, 6 /* Jul */, 10)
  380. var date2 = new Date(1987, 1 /* Feb */, 11)
  381. var minDate = min(date1, date2)
  382. var maxDate = max(date1, date2)
  383. // v2.0.0 onward:
  384. var dates = [new Date(1989, 6 /* Jul */, 10), new Date(1987, 1 /* Feb */, 11)]
  385. var minDate = min(dates)
  386. var maxDate = max(dates)
  387. ```
  388. - **BREAKING**: make the second argument of `format` required for the sake of explicitness.
  389. ```javascript
  390. // Before v2.0.0
  391. format(new Date(2016, 0, 1))
  392. // v2.0.0 onward
  393. format(new Date(2016, 0, 1), "yyyy-MM-dd'T'HH:mm:ss.SSSxxx")
  394. ```
  395. - **BREAKING** renamed ISO week-numbering year helpers:
  396. - `addISOYears` → `addISOWeekYears`
  397. - `differenceInCalendarISOYears` → `differenceInCalendarISOWeekYears`
  398. - `differenceInISOYears` → `differenceInISOWeekYears`
  399. - `endOfISOYear` → `endOfISOWeekYear`
  400. - `getISOYear` → `getISOWeekYear`
  401. - `isSameISOYear` → `isSameISOWeekYear`
  402. - `lastDayOfISOYear` → `lastDayOfISOWeekYear`
  403. - `setISOYear` → `setISOWeekYear`
  404. - `subISOYears` → `subISOWeekYears`
  405. i.e. "ISO year" renamed to "ISO week year", which is short for
  406. [ISO week-numbering year](https://en.wikipedia.org/wiki/ISO_week_date).
  407. It makes them consistent with locale-dependent week-numbering year helpers,
  408. e.g., `startOfWeekYear`.
  409. - **BREAKING**: functions renamed:
  410. - `areRangesOverlapping` → `areIntervalsOverlapping`
  411. - `eachDay` → `eachDayOfInterval`
  412. - `getOverlappingDaysInRanges` → `getOverlappingDaysInIntervals`
  413. - `isWithinRange` → `isWithinInterval`
  414. This change was made to mirror the use of the word "interval" in standard ISO 8601:2004 terminology:
  415. ```
  416. 2.1.3
  417. time interval
  418. part of the time axis limited by two instants
  419. ```
  420. Also these functions now accept an object with `start` and `end` properties
  421. instead of two arguments as an interval. All these functions
  422. throw `RangeError` if the start of the interval is after its end
  423. or if any date in the interval is `Invalid Date`.
  424. ```javascript
  425. // Before v2.0.0
  426. areRangesOverlapping(
  427. new Date(2014, 0, 10),
  428. new Date(2014, 0, 20),
  429. new Date(2014, 0, 17),
  430. new Date(2014, 0, 21)
  431. )
  432. eachDay(new Date(2014, 0, 10), new Date(2014, 0, 20))
  433. getOverlappingDaysInRanges(
  434. new Date(2014, 0, 10),
  435. new Date(2014, 0, 20),
  436. new Date(2014, 0, 17),
  437. new Date(2014, 0, 21)
  438. )
  439. isWithinRange(
  440. new Date(2014, 0, 3),
  441. new Date(2014, 0, 1),
  442. new Date(2014, 0, 7)
  443. )
  444. // v2.0.0 onward
  445. areIntervalsOverlapping(
  446. { start: new Date(2014, 0, 10), end: new Date(2014, 0, 20) },
  447. { start: new Date(2014, 0, 17), end: new Date(2014, 0, 21) }
  448. )
  449. eachDayOfInterval({
  450. start: new Date(2014, 0, 10),
  451. end: new Date(2014, 0, 20)
  452. })
  453. getOverlappingDaysInIntervals(
  454. { start: new Date(2014, 0, 10), end: new Date(2014, 0, 20) },
  455. { start: new Date(2014, 0, 17), end: new Date(2014, 0, 21) }
  456. )
  457. isWithinInterval(new Date(2014, 0, 3), {
  458. start: new Date(2014, 0, 1),
  459. end: new Date(2014, 0, 7)
  460. })
  461. ```
  462. - **BREAKING**: functions renamed:
  463. - `distanceInWords` → `formatDistance`
  464. - `distanceInWordsStrict` → `formatDistanceStrict`
  465. - `distanceInWordsToNow` → `formatDistanceToNow`
  466. to make them consistent with `format` and `formatRelative`.
  467. - **BREAKING**: The order of arguments of `distanceInWords` and `distanceInWordsStrict`
  468. is swapped to make them consistent with `differenceIn...` functions.
  469. ```javascript
  470. // Before v2.0.0
  471. distanceInWords(
  472. new Date(1986, 3, 4, 10, 32, 0),
  473. new Date(1986, 3, 4, 11, 32, 0),
  474. { addSuffix: true }
  475. ) //=> 'in about 1 hour'
  476. // v2.0.0 onward
  477. formatDistance(
  478. new Date(1986, 3, 4, 11, 32, 0),
  479. new Date(1986, 3, 4, 10, 32, 0),
  480. { addSuffix: true }
  481. ) //=> 'in about 1 hour'
  482. ```
  483. - **BREAKING**: `partialMethod` option in `formatDistanceStrict` is renamed to `roundingMethod`.
  484. ```javascript
  485. // Before v2.0.0
  486. distanceInWordsStrict(
  487. new Date(1986, 3, 4, 10, 32, 0),
  488. new Date(1986, 3, 4, 10, 33, 1),
  489. { partialMethod: 'ceil' }
  490. ) //=> '2 minutes'
  491. // v2.0.0 onward
  492. formatDistanceStrict(
  493. new Date(1986, 3, 4, 10, 33, 1),
  494. new Date(1986, 3, 4, 10, 32, 0),
  495. { roundingMethod: 'ceil' }
  496. ) //=> '2 minutes'
  497. ```
  498. - **BREAKING**: in `formatDistanceStrict`, if `roundingMethod` is not specified,
  499. it now defaults to `round` instead of `floor`.
  500. - **BREAKING**: `unit` option in `formatDistanceStrict` now accepts one of the strings:
  501. 'second', 'minute', 'hour', 'day', 'month' or 'year' instead of 's', 'm', 'h', 'd', 'M' or 'Y'
  502. ```javascript
  503. // Before v2.0.0
  504. distanceInWordsStrict(
  505. new Date(1986, 3, 4, 10, 32, 0),
  506. new Date(1986, 3, 4, 10, 33, 1),
  507. { unit: 'm' }
  508. )
  509. // v2.0.0 onward
  510. formatDistanceStrict(
  511. new Date(1986, 3, 4, 10, 33, 1),
  512. new Date(1986, 3, 4, 10, 32, 0),
  513. { unit: 'minute' }
  514. )
  515. ```
  516. - **BREAKING**: `parse` that previously used to convert strings and
  517. numbers to dates now parse only strings in an arbitrary format
  518. specified as an argument. Use `toDate` to coerce numbers and `parseISO`
  519. to parse ISO 8601 strings.
  520. ```javascript
  521. // Before v2.0.0
  522. parse('2016-01-01')
  523. parse(1547005581366)
  524. parse(new Date()) // Clone the date
  525. // v2.0.0 onward
  526. parse('2016-01-01', 'yyyy-MM-dd', new Date())
  527. parseISO('2016-01-01')
  528. toDate(1547005581366)
  529. toDate(new Date()) // Clone the date
  530. ```
  531. - **BREAKING**: `toDate` (previously `parse`) now doesn't accept string
  532. arguments but only numbers and dates. `toDate` called with an invalid
  533. argument will return `Invalid Date`.
  534. - **BREAKING**: new locale format.
  535. See [docs/Locale](https://date-fns.org/docs/Locale).
  536. Locales renamed:
  537. - `en` → `en-US`
  538. - `zh_cn` → `zh-CN`
  539. - `zh_tw` → `zh-TW`
  540. ```javascript
  541. // Before v2.0.0
  542. import locale from 'date-fns/locale/zh_cn'
  543. // v2.0.0 onward
  544. import locale from 'date-fns/locale/zh-CN'
  545. ```
  546. - **BREAKING**: now `closestTo` and `closestIndexTo` don't throw an exception
  547. when the second argument is not an array, and return Invalid Date instead.
  548. - **BREAKING**: now `isValid` doesn't throw an exception
  549. if the first argument is not an instance of Date.
  550. Instead, argument is converted beforehand using `toDate`.
  551. Examples:
  552. | `isValid` argument | Before v2.0.0 | v2.0.0 onward |
  553. | ------------------------- | ------------- | ------------- |
  554. | `new Date()` | `true` | `true` |
  555. | `new Date('2016-01-01')` | `true` | `true` |
  556. | `new Date('')` | `false` | `false` |
  557. | `new Date(1488370835081)` | `true` | `true` |
  558. | `new Date(NaN)` | `false` | `false` |
  559. | `'2016-01-01'` | `TypeError` | `false` |
  560. | `''` | `TypeError` | `false` |
  561. | `1488370835081` | `TypeError` | `true` |
  562. | `NaN` | `TypeError` | `false` |
  563. We introduce this change to make _date-fns_ consistent with ECMAScript behavior
  564. that try to coerce arguments to the expected type
  565. (which is also the case with other _date-fns_ functions).
  566. - **BREAKING**: functions now throw `RangeError` if optional values passed to `options`
  567. are not `undefined` or have expected values.
  568. This change is introduced for consistency with ECMAScript standard library which does the same.
  569. - **BREAKING**: `format`, `formatDistance` (previously `distanceInWords`) and
  570. `formatDistanceStrict` (previously `distanceInWordsStrict`) now throw
  571. `RangeError` if one the passed arguments is invalid. It reflects behavior of
  572. `toISOString` and Intl API. See [#1032](https://github.com/date-fns/date-fns/pull/1032).
  573. - **BREAKING**: all functions now implicitly convert arguments by following rules:
  574. | | date | number | string | boolean |
  575. | --------- | ------------ | ------ | ----------- | ------- |
  576. | 0 | new Date(0) | 0 | '0' | false |
  577. | '0' | Invalid Date | 0 | '0' | false |
  578. | 1 | new Date(1) | 1 | '1' | true |
  579. | '1' | Invalid Date | 1 | '1' | true |
  580. | true | Invalid Date | NaN | 'true' | true |
  581. | false | Invalid Date | NaN | 'false' | false |
  582. | null | Invalid Date | NaN | 'null' | false |
  583. | undefined | Invalid Date | NaN | 'undefined' | false |
  584. | NaN | Invalid Date | NaN | 'NaN' | false |
  585. Notes:
  586. - as before, arguments expected to be `Date` are converted to `Date` using _date-fns'_ `toDate` function;
  587. - arguments expected to be numbers are converted to integer numbers using our custom `toInteger` implementation
  588. (see [#765](https://github.com/date-fns/date-fns/pull/765));
  589. - arguments expected to be strings are converted to strings using JavaScript's `String` function;
  590. - arguments expected to be booleans are converted to boolean using JavaScript's `Boolean` function.
  591. `null` and `undefined` passed to optional arguments (i.e. properties of `options` argument)
  592. are ignored as if no argument was passed.
  593. If any resulting argument is invalid (i.e. `NaN` for numbers and `Invalid Date` for dates),
  594. an invalid value will be returned:
  595. - `false` for functions that return booleans (expect `isValid`);
  596. - `Invalid Date` for functions that return dates;
  597. - and `NaN` for functions that return numbers.
  598. See tests and PRs [#460](https://github.com/date-fns/date-fns/pull/460) and
  599. [#765](https://github.com/date-fns/date-fns/pull/765) for exact behavior.
  600. - **BREAKING**: all functions now check if the passed number of arguments is less
  601. than the number of required arguments and throw `TypeError` exception if so.
  602. - **BREAKING**: all functions that accept numbers as arguments, now coerce
  603. values using `Number()` and also round decimals. Positive decimals are
  604. rounded using `Math.floor`, decimals less than zero are rounded using
  605. `Math.ceil`.
  606. - **BREAKING**: The Bower & UMD/CDN package versions are no longer supported.
  607. - **BREAKING**: `null` now is not a valid date. `isValid(null)` returns `false`;
  608. `toDate(null)` returns an invalid date. Since `toDate` is used internally
  609. by all the functions, operations over `null` will also return an invalid date.
  610. [See #537](https://github.com/date-fns/date-fns/issues/537) for the reasoning.
  611. - `toDate` (previously `parse`) and `isValid` functions now accept `any` type
  612. as the first argument.
  613. - [Exclude `docs.json` from the npm package](https://github.com/date-fns/date-fns/pull/837). Kudos to [@hawkrives](https://github.com/hawkrives).
  614. ### Added
  615. - FP functions like those in [lodash](https://github.com/lodash/lodash/wiki/FP-Guide),
  616. that support [currying](https://en.wikipedia.org/wiki/Currying), and, as a consequence,
  617. functional-style [function composing](https://medium.com/making-internets/why-using-chain-is-a-mistake-9bc1f80d51ba).
  618. Functions with options (`format`, `parse`, etc.) have two FP counterparts:
  619. one that has the options object as its first argument and one that hasn't.
  620. The name of the former has `WithOptions` added to the end of its name.
  621. In FP functions, the order of arguments is reversed.
  622. See [FP Guide](docs/fp) for more information.
  623. ```javascript
  624. import addYears from 'date-fns/fp/addYears'
  625. import formatWithOptions from 'date-fns/fp/formatWithOptions'
  626. import eo from 'date-fns/locale/eo'
  627. // If FP function has not received enough arguments, it returns another function
  628. const addFiveYears = addYears(5)
  629. // Several arguments can be curried at once
  630. const dateToString = formatWithOptions({ locale: eo }, 'd MMMM yyyy')
  631. const dates = [
  632. new Date(2017, 0 /* Jan */, 1),
  633. new Date(2017, 1 /* Feb */, 11),
  634. new Date(2017, 6 /* Jul */, 2)
  635. ]
  636. const formattedDates = dates.map(date => dateToString(addFiveYears(date)))
  637. //=> ['1 januaro 2022', '11 februaro 2022', '2 julio 2022']
  638. ```
  639. - Added support for [ECMAScript Modules](http://www.ecma-international.org/ecma-262/6.0/#sec-modules).
  640. It allows usage with bundlers that support tree-shaking,
  641. like [rollup.js](http://rollupjs.org) and [webpack](https://webpack.js.org):
  642. ```javascript
  643. // Without tree-shaking:
  644. import format from 'date-fns/format'
  645. import parse from 'date-fns/parse'
  646. // With tree-shaking:
  647. import { format, parse } from 'date-fns'
  648. ```
  649. Also, ESM functions provide default export, they can be used with TypeScript
  650. to import functions in more idiomatic way:
  651. ```typescript
  652. // Before
  653. import * as format from 'date-fns/format'
  654. // Now
  655. import format from 'date-fns/format'
  656. ```
  657. - `formatRelative` function. See [formatRelative](https://date-fns.org/docs/formatRelative)
  658. - Flow typings for `index.js`, `fp/index.js`, `locale/index.js`, and their ESM equivalents.
  659. See PR [#558](https://github.com/date-fns/date-fns/pull/558)
  660. - New locale-dependent week-numbering year helpers:
  661. - `getWeek`
  662. - `getWeekYear`
  663. - `setWeek`
  664. - `setWeekYear`
  665. - `startOfWeekYear`
  666. - Added `eachWeekOfInterval`, the weekly equivalent of `eachDayOfInterval`
  667. - [Added `getUnixTime` function](https://github.com/date-fns/date-fns/pull/870). Kudos to [@Kingwl](https://github.com/Kingwl).
  668. - [New decade helpers](https://github.com/date-fns/date-fns/pull/839). Thanks to [@y-nk](https://github.com/y-nk)!
  669. - `getDecade`
  670. - `startOfDecade`
  671. - `endOfDecade`
  672. - `lastDayOfDecade`
  673. - [New `roundToNearestMinutes` function](https://github.com/date-fns/date-fns/pull/928). Kudos to [@xkizer](https://github.com/xkizer).
  674. - Added new function `fromUnixTime`. Thansk to [@xkizer](https://github.com/xkizer).
  675. - New interval, month, and year helpers to fetch a list of all Saturdays and Sundays (weekends) for a given date interval. `eachWeekendOfInterval` is the handler function while the other two are wrapper functions. Kudos to [@laekettavong](https://github.com/laekettavong)!
  676. - `eachWeekendOfInterval`
  677. - `eachWeekendOfMonth`
  678. - `eachWeekendOfYear`
  679. - Build-efficient `lightFormat` that only supports the popular subset of tokens. See [#1050](https://github.com/date-fns/date-fns/pull/1015).
  680. - `parseISO` function that parses ISO 8601 strings. See [#1023](https://github.com/date-fns/date-fns/pull/1023).
  681. - Add constants that can be imported directly from `date-fns` or the submodule `date-fns/constants`:
  682. - `maxTime`
  683. - `minTime`
  684. - New locales:
  685. - [Norwegian Nynorsk locale (nn)](https://github.com/date-fns/date-fns/pull/1172)
  686. by [@draperunner](https://github.com/draperunner).
  687. - [Ukrainian locale (ua)](https://github.com/date-fns/date-fns/pull/532)
  688. by [@korzhyk](https://github.com/korzhyk).
  689. - [Vietnamese locale (vi)](https://github.com/date-fns/date-fns/pull/546)
  690. by [@trongthanh](https://github.com/trongthanh).
  691. - [Persian locale (fa-IR)](https://github.com/date-fns/date-fns/pull/1113)
  692. by [@mort3za](https://github.com/mort3za).
  693. - [Latvian locale (lv)](https://github.com/date-fns/date-fns/pull/1175)
  694. by [@prudolfs](https://github.com/prudolfs).
  695. - [Bengali locale (bb)](https://github.com/date-fns/date-fns/pull/845)
  696. by [@nutboltu](https://github.com/nutboltu) and [@touhidrahman](https://github.com/touhidrahman).
  697. - [Hungarian (hu) and Lithuanian (lt) locales](https://github.com/date-fns/date-fns/pull/864)
  698. by [@izifortune](https://github.com/izifortune) and [pardoeryanair](https://github.com/pardoeryanair).
  699. - [Canadian English locale (en-CA)](https://github.com/date-fns/date-fns/pull/688)
  700. by [@markowsiak](https://github.com/markowsiak).
  701. - [Great Britain English locale (en-GB)](https://github.com/date-fns/date-fns/pull/563)
  702. by [@glintik](https://github.com/glintik).
  703. - [Uighur locale (ug)](https://github.com/date-fns/date-fns/pull/1080)
  704. by [@abduwaly](https://github.com/abduwaly).
  705. - [Add new function `differenceInBusinessDays`](https://github.com/date-fns/date-fns/pull/1194)
  706. which calculates the difference in business days. Kudos to [@ThorrStevens](https://github.com/ThorrStevens)!
  707. - [Add new function `addBusinessDays`](https://github.com/date-fns/date-fns/pull/1154),
  708. similar to `addDays` but ignoring weekends. Thanks to [@ThorrStevens](https://github.com/ThorrStevens)!
  709. ## [1.30.1] - 2018-12-10
  710. ### Fixed
  711. - [Fixed DST issue](https://github.com/date-fns/date-fns/pull/1005). See [#972](https://github.com/date-fns/date-fns/issues/972) and [#992](https://github.com/date-fns/date-fns/issues/992) for more details. This fix was backported from v2.
  712. - Fix a few bugs that appear in timezones with offsets that include seconds (e.g. GMT+00:57:44). See PR [#789](https://github.com/date-fns/date-fns/issues/789). This fix was backported from v2.
  713. - [Fix misspelled January in the Thai locale](https://github.com/date-fns/date-fns/pull/913). Thanks to [@ratchapol-an](https://github.com/ratchapol-an)!
  714. ### Added
  715. - [Added Serbian locale](https://github.com/date-fns/date-fns/pull/717). Kudos to [@mawi12345](https://github.com/mawi12345)!
  716. - [Added Belarusian locale](https://github.com/date-fns/date-fns/pull/716). Kudos to [@mawi12345](https://github.com/mawi12345) again!
  717. ### Changed
  718. - [Improve ja translation of distanceInWords](https://github.com/date-fns/date-fns/pull/880). Thanks to [@kudohamu](https://github.com/kudohamu)!
  719. ## [1.30.0] - 2018-12-10
  720. ⚠️ The release got failed.
  721. ## [1.29.0] - 2017-10-11
  722. ### Fixed
  723. - Fix Italian translations for `formatDistance`. ([see the issue: #550](https://github.com/date-fns/date-fns/issues/550); [see the PR: #552](https://github.com/date-fns/date-fns/pull/552))
  724. Thanks to [@giofilo](https://github.com/giofilo)!
  725. ### Added
  726. - [Hungarian locale (hu)](https://github.com/date-fns/date-fns/pull/503)
  727. (thanks to László Horváth [@horvathlg](https://github.com/horvathlg))
  728. - [Slovenian locale (sl)](https://github.com/date-fns/date-fns/pull/505)
  729. (thanks to Adam Stradovnik [@Neoglyph](https://github.com/Neoglyph))
  730. - Add `step` to `eachDay` function. Thanks to [@BDav24](https://github.com/BDav24).
  731. See PR [#487](https://github.com/date-fns/date-fns/pull/487).
  732. ## [1.28.5] - 2017-05-19
  733. ### Fixed
  734. - Fix a.m./p.m. formatters in Chinese Simplified locale.
  735. Thanks to [@fnlctrl](https://github.com/fnlctrl).
  736. See PR [#486](https://github.com/date-fns/date-fns/pull/486)
  737. ## [1.28.4] - 2017-04-26
  738. ### Fixed
  739. - Fix accents on weekdays in the Italian locale.
  740. See PR [#481](https://github.com/date-fns/date-fns/pull/481).
  741. Thanks to [@albertorestifo](https://github.com/albertorestifo)
  742. - Fix typo in `ddd` format token in Spanish language locale.
  743. Kudos to [@fjaguero](https://github.com/fjaguero).
  744. See PR [#482](https://github.com/date-fns/date-fns/pull/482)
  745. ## [1.28.3] - 2017-04-14
  746. ### Fixed
  747. - Fix ordinal numbers for Danish language locale. Thanks to [@kgram](https://github.com/kgram).
  748. See PR [#474](https://github.com/date-fns/date-fns/pull/474)
  749. ## [1.28.2] - 2017-03-27
  750. ### Fixed
  751. - Fix `dd` and `ddd` formatters in Polish language locale. Kudos to [@justrag](https://github.com/justrag).
  752. See PR: [#467](https://github.com/date-fns/date-fns/pull/467)
  753. ## [1.28.1] - 2017-03-19
  754. ### Fixed
  755. - Fix DST border bug in `addMilliseconds`, `addSeconds`, `addMinutes`, `addHours`,
  756. `subMilliseconds`, `subSeconds`, `subMinutes` and `subHours`.
  757. See issue [#465](https://github.com/date-fns/date-fns/issues/465)
  758. - Minor fix for Indonesian locale. Thanks to [@bentinata](https://github.com/bentinata).
  759. See PR: [#458](https://github.com/date-fns/date-fns/pull/458)
  760. ## [1.28.0] - 2017-02-27
  761. ### Added
  762. - [Romanian locale (ro)](https://github.com/date-fns/date-fns/pull/446)
  763. (thanks to Sergiu Munteanu [@jsergiu](https://github.com/jsergiu))
  764. ### Fixed
  765. - All functions now convert all their arguments to the respective types.
  766. See PR: [#443](https://github.com/date-fns/date-fns/pull/443)
  767. - Fixes for ordinals (1er, 2, 3, …) in French locale.
  768. Thanks to [@fbonzon](https://github.com/fbonzon).
  769. See PR: [#449](https://github.com/date-fns/date-fns/pull/449)
  770. ## [1.27.2] - 2017-02-01
  771. ### Fixed
  772. - Various fixes for Dutch locale. See PR: [#416](https://github.com/date-fns/date-fns/pull/416).
  773. Thanks to Ruben Stolk [@rubenstolk](https://github.com/rubenstolk)
  774. ## [1.27.1] - 2017-01-20
  775. ### Fixed
  776. - Added generation of TypeScript locale sub-modules, allowing import of locales in TypeScript.
  777. ## [1.27.0] - 2017-01-19
  778. ### Added
  779. - [Macedonian locale (mk)](https://github.com/date-fns/date-fns/pull/398)
  780. (thanks to Petar Vlahu [@vlahupetar](https://github.com/vlahupetar))
  781. ## [1.26.0] - 2017-01-15
  782. ### Added
  783. - `getTime`
  784. ### Fixed
  785. - Various fixes for Japanese locale. See PR: [395](https://github.com/date-fns/date-fns/pull/395).
  786. Thanks to Yamagishi Kazutoshi [@ykzts](https://github.com/ykzts)
  787. ## [1.25.0] - 2017-01-11
  788. ### Added
  789. - [Bulgarian locale (bg)](https://github.com/date-fns/date-fns/pull/357)
  790. (thanks to Nikolay Stoynov [@arvigeus](https://github.com/arvigeus))
  791. - [Czech locale (cs)](https://github.com/date-fns/date-fns/pull/386)
  792. (thanks to David Rus [@davidrus](https://github.com/davidrus))
  793. ## [1.24.0] - 2017-01-06
  794. ### Added
  795. - [Modern Standard Arabic locale (ar)](https://github.com/date-fns/date-fns/pull/367)
  796. (thanks to Abdallah Hassan [@AbdallahAHO](https://github.com/AbdallahAHO))
  797. ## [1.23.0] - 2017-01-05
  798. ### Added
  799. - Auto generate TypeScript and flow typings from documentation on release.
  800. Thanks to [@mattlewis92](https://github.com/mattlewis92).
  801. See related PRs: [#355](https://github.com/date-fns/date-fns/pull/355),
  802. [#370](https://github.com/date-fns/date-fns/pull/370)
  803. - [Croatian locale (hr)](https://github.com/date-fns/date-fns/pull/365)
  804. (thanks to Matija Marohnić [@silvenon](https://github.com/silvenon))
  805. - [Thai locale (th)](https://github.com/date-fns/date-fns/pull/362)
  806. (thanks to Athiwat Hirunworawongkun [@athivvat](https://github.com/athivvat))
  807. - [Finnish locale (fi)](https://github.com/date-fns/date-fns/pull/361)
  808. (thanks to Pyry-Samuli Lahti [@Pyppe](https://github.com/Pyppe))
  809. ## [1.22.0] - 2016-12-28
  810. ### Added
  811. - [Icelandic locale (is)](https://github.com/date-fns/date-fns/pull/356)
  812. (thanks to Derek Blank [@derekblank](https://github.com/derekblank))
  813. ## [1.21.1] - 2016-12-18
  814. ### Fixed
  815. - Fix `isBefore` and `isAfter` documentation mistakes.
  816. ## [1.21.0] - 2016-12-16
  817. ### Added
  818. - [Filipino locale (fil)](https://github.com/date-fns/date-fns/pull/339)
  819. (thanks to Ian De La Cruz [@RIanDeLaCruz](https://github.com/RIanDeLaCruz))
  820. - [Danish locale (da)](https://github.com/date-fns/date-fns/pull/343)
  821. (kudos to Anders B. Hansen [@Andersbiha](https://github.com/Andersbiha))
  822. ## [1.20.1] - 2016-12-14
  823. ### Fixed
  824. - Fix documentation for `getOverlappingDaysInRanges`.
  825. ## [1.20.0] - 2016-12-13
  826. ### Added
  827. - `areRangesOverlapping` and `getOverlappingDaysInRanges`
  828. Thanks to Joanna T [@asia-t](https://github.com/asia-t).
  829. See PR: [#331](https://github.com/date-fns/date-fns/pull/331)
  830. ## [1.19.0] - 2016-12-13
  831. ### Added
  832. - [Greek locale (el)](https://github.com/date-fns/date-fns/pull/334)
  833. (kudos to Theodoros Orfanidis [@teoulas](https://github.com/teoulas))
  834. - [Slovak locale (sk)](https://github.com/date-fns/date-fns/pull/336)
  835. (kudos to Marek Suscak [@mareksuscak](https://github.com/mareksuscak))
  836. - Add yarn support.
  837. Thanks to Uladzimir Havenchyk [@havenchyk](https://github.com/havenchyk).
  838. See PR: [#288](https://github.com/date-fns/date-fns/pull/288)
  839. ## [1.18.0] - 2016-12-12
  840. ### Added
  841. - [Turkish locale (tr)](https://github.com/date-fns/date-fns/pull/329)
  842. (kudos to Alpcan Aydın [@alpcanaydin](https://github.com/alpcanaydin))
  843. - [Korean locale (ko)](https://github.com/date-fns/date-fns/pull/327)
  844. (thanks to Hong Chulju [@angdev](https://github.com/angdev))
  845. ### Fixed
  846. - `SS` and `SSS` formats in `format` are now correctly displayed with leading zeros.
  847. Thanks to Paul Dijou [@pauldijou](https://github.com/pauldijou).
  848. See PR: [#330](https://github.com/date-fns/date-fns/pull/330)
  849. ## [1.17.0] - 2016-12-10
  850. ### Added
  851. - [Polish locale (pl)](https://github.com/date-fns/date-fns/pull/294)
  852. (thanks to Mateusz Derks [@ertrzyiks](https://github.com/ertrzyiks))
  853. - [Portuguese locale (pt)](https://github.com/date-fns/date-fns/pull/316)
  854. (thanks to Dário Freire [@dfreire](https://github.com/dfreire))
  855. - [Swedish locale (sv)](https://github.com/date-fns/date-fns/pull/311)
  856. (thanks to Johannes Ulén [@ejulen](https://github.com/ejulen))
  857. - [French locale (fr)](https://github.com/date-fns/date-fns/pull/281)
  858. (thanks to Jean Dupouy [@izeau](https://github.com/izeau))
  859. - Performance tests. See PR: [#289](https://github.com/date-fns/date-fns/pull/289)
  860. ### Fixed
  861. - Fix TypeScript and flow typings for `isValid`.
  862. See PR: [#310](https://github.com/date-fns/date-fns/pull/310)
  863. - Fix incorrect locale tests that could potentially lead to `format` bugs.
  864. Kudos to Mateusz Derks [@ertrzyiks](https://github.com/ertrzyiks).
  865. See related PRs: [#312](https://github.com/date-fns/date-fns/pull/312),
  866. [#320](https://github.com/date-fns/date-fns/pull/320)
  867. - Minor language fixes in the documentation.
  868. Thanks to Vedad Šoše [@vedadsose](https://github.com/vedadsose) ([#314](https://github.com/date-fns/date-fns/pull/314))
  869. and Asia [@asia-t](https://github.com/asia-t) ([#318](https://github.com/date-fns/date-fns/pull/318))
  870. ### Changed
  871. - `format` now returns `String('Invalid Date')` if the passed date is invalid.
  872. See PR: [#323](https://github.com/date-fns/date-fns/pull/323)
  873. - `distanceInWords`, `distanceInWordsToNow`, `distanceInWordsStrict` and `format` functions now
  874. check if the passed locale is valid, and fallback to English locale otherwise.
  875. See PR: [#321](https://github.com/date-fns/date-fns/pull/321)
  876. - _Internal_: use a loop instead of `Object.keys` in `buildFormattingTokensRegExp`
  877. to improve compatibility with older browsers.
  878. See PR: [#322](https://github.com/date-fns/date-fns/pull/322)
  879. ## [1.16.0] - 2016-12-08
  880. ### Added
  881. - [Italian locale (it)](https://github.com/date-fns/date-fns/pull/298)
  882. (thanks to Alberto Restifo [@albertorestifo](https://github.com/albertorestifo))
  883. - For German `buildDistanceInWordsLocale`, add nominative case translations (for distances without a suffix).
  884. Kudos to Asia [@asia-t](https://github.com/asia-t).
  885. See related PR: [#295](https://github.com/date-fns/date-fns/pull/295)
  886. ## [1.15.1] - 2016-12-07
  887. ### Fixed
  888. - Fixed TypeScript imports from individual modules.
  889. Thanks to [@mattlewis92](https://github.com/mattlewis92).
  890. See related PR: [#287](https://github.com/date-fns/date-fns/pull/287)
  891. ## [1.15.0] - 2016-12-07
  892. ### Added
  893. - [Indonesian locale (id)](https://github.com/date-fns/date-fns/pull/299)
  894. (thanks to Rahmat Budiharso [@rbudiharso](https://github.com/rbudiharso))
  895. - [Catalan locale (ca)](https://github.com/date-fns/date-fns/pull/300)
  896. (thanks to Guillermo Grau [@guigrpa](https://github.com/guigrpa))
  897. ### Fixed
  898. - Fix some inaccuracies in Spanish locale.
  899. Kudos to [@guigrpa](https://github.com/guigrpa).
  900. See related PR: [#302](https://github.com/date-fns/date-fns/pull/302)
  901. ## [1.14.1] - 2016-12-06
  902. ### Fixed
  903. - Fixed broken test for Norwegian Bokmål locale.
  904. ## [1.14.0] - 2016-12-06
  905. ### Added
  906. - [Norwegian Bokmål locale (nb)](https://github.com/date-fns/date-fns/pull/291)
  907. (thanks to Hans-Kristian Koren [@Hanse](https://github.com/Hanse))
  908. ## [1.13.0] - 2016-12-06
  909. ### Added
  910. - [Chinese Traditional locale (zh_tw)](https://github.com/date-fns/date-fns/pull/283)
  911. (thanks to tonypai [@tpai](https://github.com/tpai)).
  912. - [Dutch language locale (nl)](https://github.com/date-fns/date-fns/pull/278)
  913. (kudos to Jorik Tangelder [@jtangelder](https://github.com/jtangelder))
  914. ## [1.12.1] - 2016-12-05
  915. ### Fixed
  916. - Added `distanceInWordsStrict` to the list of supported functions in I18n doc.
  917. ## [1.12.0] - 2016-12-05
  918. ### Added
  919. - [Spanish language locale (es)](https://github.com/date-fns/date-fns/pull/269)
  920. (thanks to Juan Angosto [@juanangosto](https://github.com/juanangosto)).
  921. ### Fixed
  922. - Fix flow typings for some of the functions.
  923. See PR: [#273](https://github.com/date-fns/date-fns/pull/273)
  924. ## [1.11.2] - 2016-11-28
  925. ### Fixed
  926. - Bug in `parse` when it sometimes parses ISO week-numbering dates incorrectly.
  927. See PR: [#262](https://github.com/date-fns/date-fns/pull/262)
  928. - Bug in some functions which caused them to handle dates earlier than 100 AD incorrectly.
  929. See PR: [#263](https://github.com/date-fns/date-fns/pull/263)
  930. ## [1.11.1] - 2016-11-24
  931. ### Fixed
  932. - Include TypeScript typings with npm package.
  933. ## [1.11.0] - 2016-11-23
  934. ### Added
  935. - `distanceInWordsStrict`.
  936. Kudos to [@STRML](https://github.com/STRML).
  937. See related PR: [#254](https://github.com/date-fns/date-fns/pull/254)
  938. - [TypeScript](https://www.typescriptlang.org/) typings for all functions.
  939. Kudos to [@mattlewis92](https://github.com/mattlewis92).
  940. See related PR: [#255](https://github.com/date-fns/date-fns/pull/255)
  941. ## [1.10.0] - 2016-11-01
  942. ### Added
  943. - `parse` now can parse dates that are ISO 8601 centuries (e.g., `19` and `+0019`).
  944. ```javascript
  945. var result = parse('19')
  946. //=> Mon Jan 01 1900 00:00:00
  947. ```
  948. - In `parse`, added ability to specify the number of additional digits
  949. for extended year or century format (possible values are 0, 1 or 2; default is 2).
  950. ```javascript
  951. parse('+002016-11-01')
  952. parse('+02016-11-01', { additionalDigits: 1 })
  953. parse('+2016-11-01', { additionalDigits: 0 })
  954. ```
  955. ## [1.9.0] - 2016-10-25
  956. ### Added
  957. - Got index.js imports to work with SystemJS.
  958. ## [1.8.1] - 2016-10-24
  959. ### Fixed
  960. - Added Japanese and German language locales to the list in I18n doc.
  961. ## [1.8.0] - 2016-10-23
  962. ### Added
  963. - [Japanese language locale (ja)](https://github.com/date-fns/date-fns/pull/241)
  964. (thanks to Thomas Eilmsteiner [@DeMuu](https://github.com/DeMuu) again!)
  965. - `getISODay`
  966. - `setISODay`
  967. ## [1.7.0] - 2016-10-20
  968. ### Added
  969. - [German language locale (de)](https://github.com/date-fns/date-fns/pull/237)
  970. (thanks to Thomas Eilmsteiner [@DeMuu](https://github.com/DeMuu)).
  971. ## [1.6.0] - 2016-10-16
  972. ### Added
  973. - [Chinese Simplified locale (zh_cn)](https://github.com/date-fns/date-fns/pull/235)
  974. (kudos to Changyu [@KingMario](https://github.com/KingMario) Geng).
  975. ## [1.5.2] - 2016-10-13
  976. ### Fixed
  977. - Incorrectly generated docs for `format`.
  978. - Fixed typo in I18n doc.
  979. ## [1.5.1] - 2016-10-12
  980. ### Fixed
  981. - A change log entry for [1.5.0] is added.
  982. ## [1.5.0] - 2016-10-12
  983. ### Added
  984. - [The initial I18n support](https://date-fns.org/docs/I18n)
  985. ## [1.4.0] - 2016-10-09
  986. ### Added
  987. - Basic [SystemJS](https://github.com/systemjs/systemjs) support.
  988. ### Fixed
  989. - Fix incorrect behaviour of `YYYY` and `YY` for years prior to 1000:
  990. now `format(new Date('0001-01-01'), 'YYYY-MM-DD')` returns `0001-01-01`
  991. instead of `1-01-01`.
  992. ## [1.3.0] - 2016-05-26
  993. ### Added
  994. - `closestIndexTo`
  995. ## [1.2.0] - 2016-05-23
  996. ### Added
  997. - Add an ability to pass negative numbers to `setDay`.
  998. ## [1.1.1] - 2016-05-19
  999. ### Fixed
  1000. - Fix [Flow](http://flowtype.org/) declarations for some of the functions.
  1001. ## [1.1.0] - 2016-05-19
  1002. ### Added
  1003. - [Flow](http://flowtype.org/) declarations for each function
  1004. in [the ".js.flow" style](http://flowtype.org/docs/declarations.html#declaration-files).
  1005. Kudos to [@JohnyDays](https://github.com/JohnyDays). See related PRs:
  1006. - [#205](https://github.com/date-fns/date-fns/pull/205)
  1007. - [#207](https://github.com/date-fns/date-fns/pull/207)
  1008. ## [1.0.0] - 2016-05-18
  1009. ### Fixed
  1010. - `format` now returns the correct result for key `E`.
  1011. - Prevent `startOf...`, `endOf...` and `lastDayOf...` functions
  1012. to return dates with an incorrect time when the date is modifying
  1013. into another time zone.
  1014. - `parse` now parses years from 1 AD to 99 AD correctly.
  1015. - Fix a bug in `getISOWeek` appearing because of a changing time zone
  1016. (e.g., when the given date is in DST and the start of the ISO year is not).
  1017. ### Changed
  1018. - **BREAKING**: all functions are moved to the root of the library, so they
  1019. are now accessible with `require('date-fns/name_of_function')` or
  1020. `import nameOfFunction from 'date-fns/name_of_function'`.
  1021. ```javascript
  1022. // Before v1.0.0
  1023. var addMonths = require('date-fns/src/add_months')
  1024. // v1.0.0 onward
  1025. var addMonths = require('date-fns/add_months')
  1026. ```
  1027. - **BREAKING**: functions that had the last optional argument `weekStartsAt`
  1028. (i.e. `endOfWeek`, `isSameWeek`, `lastDayOfWeek`, `setDay`, `startOfWeek`)
  1029. now instead receive the object `options` with the property `options.weekStartsOn`
  1030. as the last argument.
  1031. ```javascript
  1032. // Before v1.0.0
  1033. var result = endOfWeek(new Date(2014, 8, 2), 1)
  1034. // v1.0.0 onward
  1035. var result = endOfWeek(new Date(2014, 8, 2), { weekStartsOn: 1 })
  1036. ```
  1037. - **BREAKING**: remove the function `getTimeSinceMidnight` that was used inside
  1038. the other functions.
  1039. - **BREAKING**: `differenceInDays` now returns the number of full days instead
  1040. of calendar days.
  1041. - **BREAKING**: `eachDay` and `isWithinRange` now throw an exception
  1042. when the given range boundaries are invalid.
  1043. - Faster `isLeapYear`.
  1044. - _Internal_: make the documentation more verbose.
  1045. - _Internal_: convert the tests from Chai to power-assert allowing them
  1046. to run against IE8.
  1047. ### Added
  1048. - `addISOYears`
  1049. - `closestTo`
  1050. - `differenceInCalendarDays`
  1051. - `differenceInCalendarISOWeeks`
  1052. - `differenceInCalendarISOYears`
  1053. - `differenceInCalendarMonths`
  1054. - `differenceInCalendarQuarters`
  1055. - `differenceInCalendarWeeks`
  1056. - `differenceInCalendarYears`
  1057. - `differenceInHours`
  1058. - `differenceInISOYears`
  1059. - `differenceInMilliseconds`
  1060. - `differenceInMinutes`
  1061. - `differenceInMonths`
  1062. - `differenceInQuarters`
  1063. - `differenceInSeconds`
  1064. - `differenceInWeeks`
  1065. - `differenceInYears`
  1066. - `distanceInWords`
  1067. - `distanceInWordsToNow`
  1068. - `endOfISOWeek`
  1069. - `endOfISOYear`
  1070. - `endOfToday`
  1071. - `endOfTomorrow`
  1072. - `endOfYesterday`
  1073. - `getDaysInYear`
  1074. - `isDate`
  1075. - `isFriday`
  1076. - `isMonday`
  1077. - `isSameISOWeek`
  1078. - `isSameISOYear`
  1079. - `isSaturday`
  1080. - `isSunday`
  1081. - `isThisHour`
  1082. - `isThisISOWeek`
  1083. - `isThisISOYear`
  1084. - `isThisMinute`
  1085. - `isThisMonth`
  1086. - `isThisQuarter`
  1087. - `isThisSecond`
  1088. - `isThisWeek`
  1089. - `isThisYear`
  1090. - `isThursday`
  1091. - `isTomorrow`
  1092. - `isTuesday`
  1093. - `isValid`
  1094. - `isWednesday`
  1095. - `isYesterday`
  1096. - `lastDayOfISOWeek`
  1097. - `lastDayOfISOYear`
  1098. - `startOfISOWeek`
  1099. - `startOfToday`
  1100. - `startOfTomorrow`
  1101. - `startOfYesterday`
  1102. - `subISOYears`
  1103. - Add `Qo`, `W`, `Wo`, `WW`, `GG`, `GGGG`, `Z`, `ZZ`, `X`, `x` keys to `format`.
  1104. ## [0.17.0] - 2015-09-29
  1105. ### Fixed
  1106. - Fix a lot of bugs appearing when date is modifying into other time zone
  1107. (e.g., when adding months and original date is in DST but new date is not).
  1108. - Prevent instances of Date to lose milliseconds value when passed to.
  1109. `parse` in IE10.
  1110. ### Changed
  1111. - `setISOWeek` now keeps time from original date.
  1112. - _Internal_: reuse `getDaysInMonth` inside of `addMonths`.
  1113. ### Added
  1114. - `differenceInDays`
  1115. - `getTimeSinceMidnight`
  1116. - `format` now has new format key `aa`, which returns `a.m.`/`p.m.`
  1117. as opposed to `a` that returns `am`/`pm`.
  1118. - Complete UMD package (for Bower and CDN).
  1119. ## [0.16.0] - 2015-09-01
  1120. ### Changed
  1121. - Use `parse` to clean date arguments in all functions.
  1122. - `parse` now fallbacks to `new Date` when the argument
  1123. is not an ISO formatted date.
  1124. - _Internal_: reuse `getDaysInMonth` inside of `setMonth`.
  1125. ### Added
  1126. - `addQuarters`
  1127. - `addWeeks`
  1128. - `endOfQuarter`
  1129. - `getDate`
  1130. - `getDay`
  1131. - `getDaysInMonth`
  1132. - `getHours`
  1133. - `getISOWeeksInYear`
  1134. - `getMilliseconds`
  1135. - `getMinutes`
  1136. - `getMonth`
  1137. - `getSeconds`
  1138. - `getYear`
  1139. - `isLeapYear`
  1140. - `isSameHour`
  1141. - `isSameMinute`
  1142. - `isSameQuarter`
  1143. - `isSameSecond`
  1144. - `lastDayOfQuarter`
  1145. - `lastDayOfWeek`
  1146. - `max`
  1147. - `min`
  1148. - `setDate`
  1149. - `setDay`
  1150. - `setHours`
  1151. - `setMilliseconds`
  1152. - `setMinutes`
  1153. - `setSeconds`
  1154. - `startOfQuarter`
  1155. - `subQuarters`
  1156. - `subWeeks`
  1157. ## [0.15.0] - 2015-08-26
  1158. ### Changed
  1159. - `format` now returns `a.m.`/`p.m.` instead of `am`/`pm`.
  1160. - `setMonth` now sets last day of month if original date was last day
  1161. of longer month.
  1162. - _Internal_: Fix code style according to ESLint.
  1163. - _Internal_: Make tests run through all time zones.
  1164. ### Added
  1165. - `getQuarter`
  1166. - `setQuarter`
  1167. - `getDayOfYear`
  1168. - `setDayOfYear`
  1169. - `isPast`
  1170. - `addSeconds`
  1171. - `subSeconds`
  1172. - `startOfSecond`
  1173. - `endOfSecond`
  1174. - `startOfMinute`
  1175. - `endOfMinute`
  1176. - `addMilliseconds`
  1177. - `subMilliseconds`
  1178. - `endOfYear`
  1179. - `addYears`
  1180. - `subYears`
  1181. - `lastDayOfYear`
  1182. - `lastDayOfMonth`
  1183. ## [0.14.11] - 2015-08-21
  1184. ### Fixed
  1185. - `format` now uses `parse` to avoid time zone bugs.
  1186. ### Changed
  1187. - `setIsoWeek` now sets time to the start of the day.
  1188. ## [0.14.10] - 2015-07-29
  1189. ### Fixed
  1190. - `format` now behaves correctly with 12:00 am.
  1191. - `format` now behaves correctly with ordinal numbers.
  1192. ### Added
  1193. - `compareAsc`
  1194. - `compareDesc`
  1195. - `addHours`
  1196. - `subHours`
  1197. - `isSameDay`
  1198. - `parse`
  1199. - `getISOYear`
  1200. - `setISOYear`
  1201. - `startOfISOYear`
  1202. - `getISOWeek`
  1203. - `setISOWeek`
  1204. ## [0.14.9] - 2015-01-14
  1205. ### Fixed
  1206. - `addMonths` now correctly behaves with February
  1207. (see [#18](https://github.com/js-fns/date-fns/pull/18)).
  1208. ## [0.14.8] - 2014-12-25
  1209. ### Fixed
  1210. - `format` function now behaves correctly with `pm`/`am`.
  1211. ## [0.14.6] - 2014-12-04
  1212. ### Fixed
  1213. - Fix broken Bower support.
  1214. ## [0.14.0] - 2014-11-05
  1215. ### Added
  1216. - Bower package.
  1217. ## [0.13.0] - 2014-10-22
  1218. ### Added
  1219. - `addMinutes`
  1220. - `subMinutes`
  1221. - `isEqual`
  1222. - `isBefore`
  1223. - `isAfter`
  1224. ## [0.12.1] - 2014-10-19
  1225. ### Fixed
  1226. - Incorrect rounding in `DDD` formatter.
  1227. ## [0.12.0] - 2014-10-15
  1228. ### Added
  1229. - `isSameYear`
  1230. ## [0.11.0] - 2014-10-15
  1231. ### Added
  1232. - `isWithinRange`
  1233. ## [0.10.0] - 2014-10-13
  1234. ### Added
  1235. - `format`
  1236. - `startOfYear`
  1237. ## [0.9.0] - 2014-10-10
  1238. ### Changed
  1239. - _Internal_: simplify `isWeekend`
  1240. ### Added
  1241. - `isFuture`
  1242. ## [0.8.0] - 2014-10-09
  1243. ### Changed
  1244. - _Internal_: reuse `addDays` inside of `subDays`.
  1245. ### Added
  1246. - `addMonths`
  1247. - `subMonths`
  1248. - `setMonth`
  1249. - `setYear`
  1250. ## [0.7.0] - 2014-10-08
  1251. ### Added
  1252. - `isSameWeek`
  1253. ## [0.6.0] - 2014-10-07
  1254. ### Fixed
  1255. - Inconsistent behavior of `endOfMonth`.
  1256. ### Added
  1257. - `isFirstDayOfMonth`
  1258. - `isLastDayOfMonth`
  1259. - `isSameMonth`
  1260. ## [0.5.0] - 2014-10-07
  1261. ### Added
  1262. - `addDays`
  1263. - `subDays`
  1264. ## [0.4.0] - 2014-10-07
  1265. ### Added
  1266. - `startOfWeek`
  1267. - `endOfWeek`
  1268. - `eachDay`
  1269. ## [0.3.0] - 2014-10-06
  1270. ### Changed
  1271. - `startOfDay` now sets milliseconds as well.
  1272. ### Added
  1273. - `endOfDay`
  1274. - `startOfMonth`
  1275. - `endOfMonth`
  1276. ## [0.2.0] - 2014-10-06
  1277. ### Added
  1278. - `isToday`
  1279. - `isWeekend`
  1280. ## 0.1.0 - 2014-10-06
  1281. ### Added
  1282. - `startOfDay`
  1283. [unreleased]: https://github.com/date-fns/date-fns/compare/v2.13.0...HEAD
  1284. [2.13.0]: https://github.com/date-fns/date-fns/compare/v2.12.0...v2.13.0
  1285. [2.12.0]: https://github.com/date-fns/date-fns/compare/v2.11.1...v2.12.0
  1286. [2.11.1]: https://github.com/date-fns/date-fns/compare/v2.11.0...v2.11.1
  1287. [2.11.0]: https://github.com/date-fns/date-fns/compare/v2.10.0...v2.11.0
  1288. [2.10.0]: https://github.com/date-fns/date-fns/compare/v2.9.0...v2.10.0
  1289. [2.9.0]: https://github.com/date-fns/date-fns/compare/v2.8.1...v2.9.0
  1290. [2.8.1]: https://github.com/date-fns/date-fns/compare/v2.8.0...v2.8.1
  1291. [2.8.0]: https://github.com/date-fns/date-fns/compare/v2.7.0...v2.8.0
  1292. [2.7.0]: https://github.com/date-fns/date-fns/compare/v2.6.0...v2.7.0
  1293. [2.6.0]: https://github.com/date-fns/date-fns/compare/v2.5.1...v2.6.0
  1294. [2.5.1]: https://github.com/date-fns/date-fns/compare/v2.5.0...v2.5.1
  1295. [2.5.0]: https://github.com/date-fns/date-fns/compare/v2.4.1...v2.5.0
  1296. [2.4.1]: https://github.com/date-fns/date-fns/compare/v2.4.0...v2.4.1
  1297. [2.4.0]: https://github.com/date-fns/date-fns/compare/v2.3.0...v2.4.0
  1298. [2.3.0]: https://github.com/date-fns/date-fns/compare/v2.2.1...v2.3.0
  1299. [2.2.1]: https://github.com/date-fns/date-fns/compare/v2.1.0...v2.2.1
  1300. [2.1.0]: https://github.com/date-fns/date-fns/compare/v2.0.1...v2.1.0
  1301. [2.0.1]: https://github.com/date-fns/date-fns/compare/v2.0.0...v2.0.1
  1302. [2.0.0]: https://github.com/date-fns/date-fns/compare/v1.28.5...v2.0.0
  1303. [1.28.5]: https://github.com/date-fns/date-fns/compare/v1.28.4...v1.28.5
  1304. [1.28.4]: https://github.com/date-fns/date-fns/compare/v1.28.3...v1.28.4
  1305. [1.28.3]: https://github.com/date-fns/date-fns/compare/v1.28.2...v1.28.3
  1306. [1.28.2]: https://github.com/date-fns/date-fns/compare/v1.28.1...v1.28.2
  1307. [1.28.1]: https://github.com/date-fns/date-fns/compare/v1.28.0...v1.28.1
  1308. [1.28.0]: https://github.com/date-fns/date-fns/compare/v1.27.2...v1.28.0
  1309. [1.27.2]: https://github.com/date-fns/date-fns/compare/v1.27.1...v1.27.2
  1310. [1.27.1]: https://github.com/date-fns/date-fns/compare/v1.27.0...v1.27.1
  1311. [1.27.0]: https://github.com/date-fns/date-fns/compare/v1.26.0...v1.27.0
  1312. [1.26.0]: https://github.com/date-fns/date-fns/compare/v1.25.0...v1.26.0
  1313. [1.25.0]: https://github.com/date-fns/date-fns/compare/v1.24.0...v1.25.0
  1314. [1.24.0]: https://github.com/date-fns/date-fns/compare/v1.23.0...v1.24.0
  1315. [1.23.0]: https://github.com/date-fns/date-fns/compare/v1.22.0...v1.23.0
  1316. [1.22.0]: https://github.com/date-fns/date-fns/compare/v1.21.1...v1.22.0
  1317. [1.21.1]: https://github.com/date-fns/date-fns/compare/v1.21.0...v1.21.1
  1318. [1.21.0]: https://github.com/date-fns/date-fns/compare/v1.20.1...v1.21.0
  1319. [1.20.1]: https://github.com/date-fns/date-fns/compare/v1.20.0...v1.20.1
  1320. [1.20.0]: https://github.com/date-fns/date-fns/compare/v1.19.0...v1.20.0
  1321. [1.19.0]: https://github.com/date-fns/date-fns/compare/v1.18.0...v1.19.0
  1322. [1.18.0]: https://github.com/date-fns/date-fns/compare/v1.17.0...v1.18.0
  1323. [1.17.0]: https://github.com/date-fns/date-fns/compare/v1.16.0...v1.17.0
  1324. [1.16.0]: https://github.com/date-fns/date-fns/compare/v1.15.1...v1.16.0
  1325. [1.15.1]: https://github.com/date-fns/date-fns/compare/v1.15.0...v1.15.1
  1326. [1.15.0]: https://github.com/date-fns/date-fns/compare/v1.14.1...v1.15.0
  1327. [1.14.1]: https://github.com/date-fns/date-fns/compare/v1.14.0...v1.14.1
  1328. [1.14.0]: https://github.com/date-fns/date-fns/compare/v1.13.0...v1.14.0
  1329. [1.13.0]: https://github.com/date-fns/date-fns/compare/v1.12.1...v1.13.0
  1330. [1.12.1]: https://github.com/date-fns/date-fns/compare/v1.12.0...v1.12.1
  1331. [1.12.0]: https://github.com/date-fns/date-fns/compare/v1.11.2...v1.12.0
  1332. [1.11.2]: https://github.com/date-fns/date-fns/compare/v1.11.1...v1.11.2
  1333. [1.11.1]: https://github.com/date-fns/date-fns/compare/v1.11.0...v1.11.1
  1334. [1.11.0]: https://github.com/date-fns/date-fns/compare/v1.10.0...v1.11.0
  1335. [1.10.0]: https://github.com/date-fns/date-fns/compare/v1.9.0...v1.10.0
  1336. [1.9.0]: https://github.com/date-fns/date-fns/compare/v1.8.1...v1.9.0
  1337. [1.8.1]: https://github.com/date-fns/date-fns/compare/v1.8.0...v1.8.1
  1338. [1.8.0]: https://github.com/date-fns/date-fns/compare/v1.7.0...v1.8.0
  1339. [1.7.0]: https://github.com/date-fns/date-fns/compare/v1.6.0...v1.7.0
  1340. [1.6.0]: https://github.com/date-fns/date-fns/compare/v1.5.2...v1.6.0
  1341. [1.5.2]: https://github.com/date-fns/date-fns/compare/v1.5.1...v1.5.2
  1342. [1.5.1]: https://github.com/date-fns/date-fns/compare/v1.5.0...v1.5.1
  1343. [1.5.0]: https://github.com/date-fns/date-fns/compare/v1.4.0...v1.5.0
  1344. [1.4.0]: https://github.com/date-fns/date-fns/compare/v1.3.0...v1.4.0
  1345. [1.3.0]: https://github.com/date-fns/date-fns/compare/v1.2.0...v1.3.0
  1346. [1.2.0]: https://github.com/date-fns/date-fns/compare/v1.1.1...v1.2.0
  1347. [1.1.1]: https://github.com/date-fns/date-fns/compare/v1.1.0...v1.1.1
  1348. [1.1.0]: https://github.com/date-fns/date-fns/compare/v1.0.0...v1.1.0
  1349. [1.0.0]: https://github.com/date-fns/date-fns/compare/v0.17.0...v1.0.0
  1350. [0.17.0]: https://github.com/date-fns/date-fns/compare/v0.16.0...v0.17.0
  1351. [0.16.0]: https://github.com/date-fns/date-fns/compare/v0.15.0...v0.16.0
  1352. [0.15.0]: https://github.com/date-fns/date-fns/compare/v0.14.11...v0.15.0
  1353. [0.14.11]: https://github.com/date-fns/date-fns/compare/v0.14.10...v0.14.11
  1354. [0.14.10]: https://github.com/date-fns/date-fns/compare/v0.14.9...v0.14.10
  1355. [0.14.9]: https://github.com/date-fns/date-fns/compare/v0.14.8...v0.14.9
  1356. [0.14.8]: https://github.com/date-fns/date-fns/compare/v0.14.6...v0.14.8
  1357. [0.14.6]: https://github.com/date-fns/date-fns/compare/v0.14.0...v0.14.6
  1358. [0.14.0]: https://github.com/date-fns/date-fns/compare/v0.13.0...v0.14.0
  1359. [0.13.0]: https://github.com/date-fns/date-fns/compare/v0.12.1...v0.13.0
  1360. [0.12.1]: https://github.com/date-fns/date-fns/compare/v0.12.0...v0.12.1
  1361. [0.12.0]: https://github.com/date-fns/date-fns/compare/v0.11.0...v0.12.0
  1362. [0.11.0]: https://github.com/date-fns/date-fns/compare/v0.10.0...v0.11.0
  1363. [0.10.0]: https://github.com/date-fns/date-fns/compare/v0.9.0...v0.10.0
  1364. [0.9.0]: https://github.com/date-fns/date-fns/compare/v0.8.0...v0.9.0
  1365. [0.8.0]: https://github.com/date-fns/date-fns/compare/v0.7.0...v0.8.0
  1366. [0.7.0]: https://github.com/date-fns/date-fns/compare/v0.6.0...v0.7.0
  1367. [0.6.0]: https://github.com/date-fns/date-fns/compare/v0.5.0...v0.6.0
  1368. [0.5.0]: https://github.com/date-fns/date-fns/compare/v0.4.0...v0.5.0
  1369. [0.4.0]: https://github.com/date-fns/date-fns/compare/v0.3.0...v0.4.0
  1370. [0.3.0]: https://github.com/date-fns/date-fns/compare/v0.2.0...v0.3.0
  1371. [0.2.0]: https://github.com/date-fns/date-fns/compare/v0.1.0...v0.2.0