UNPKG

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