date-fns
Version:
Modern JavaScript date utility library
1 lines • 199 kB
JSON
{"General":[{"content":"# Getting Started\n\n## Table of Contents\n\n- [Introduction](#introduction)\n\n- [Installation](#installation)\n\n - [npm or yarn](#npm)\n\n - [Bower](#bower)\n\n - [CDN & Download](#cdn)\n\n - [GitHub Releases](#github-releases)\n\n## Introduction\n\n**date-fns** provides the most comprehensive, yet simple and consistent toolset\nfor manipulating **JavaScript dates** in **a browser** & **Node.js**.\n\n**date-fns** is like [lodash](https://lodash.com) for dates. It has\n[**140+ functions** for all occasions](https://date-fns.org/docs/).\n\n```js\ndateFns.format(new Date(2014, 1, 11), 'MM/DD/YYYY')\n//=> '02/11/2014'\n\nvar dates = [new Date(1995, 6, 2), new Date(1987, 1, 11), new Date(1989, 6, 10)]\ndates.sort(dateFns.compareAsc)\n//=> [\n// Wed Feb 11 1987 00:00:00,\n// Mon Jul 10 1989 00:00:00,\n// Sun Jul 02 1995 00:00:00\n// ]\n```\n\n## Installation\n\nThe library is available as an [npm package](https://www.npmjs.com/package/date-fns),\na Bower package, and is also distributed through a [CDN](http://cdn.date-fns.org/).\n\n### npm\n\nTo install the npm package, run:\n\n```bash\nnpm install date-fns --save\n#or\nyarn add date-fns\n```\n\nTo start using:\n\n```js\nvar isToday = require('date-fns/is_today')\nisToday(new Date())\n//=> true\n```\n\n### Bower\n\nTo install the Bower package, run:\n\n```bash\nbower install date-fns\n```\n\nTo start using it, add the library to your build and access it\nvia `window.dateFns`:\n\n```js\ndateFns.isToday(new Date())\n//=> true\n```\n\n### CDN\n\nTo start using date-fns, simply add the following code into HTML:\n\n```html\n<script src=\"http://cdn.date-fns.org/VERSION/date_fns.min.js\"></script>\n<script>\n dateFns.isToday(new Date())\n //=> true\n</script>\n```\n\nReplace `VERSION` with a proper version number e.g. `v1.0.0`.\n\nSee the [full list](http://cdn.date-fns.org/) of resources available on the CDN:\n\n- `http://cdn.date-fns.org/VERSION/date_fns.js`\n- `http://cdn.date-fns.org/VERSION/date_fns.js.map`\n- `http://cdn.date-fns.org/VERSION/date_fns.min.js`\n- `http://cdn.date-fns.org/VERSION/date_fns.min.js.map`\n- `http://cdn.date-fns.org/VERSION/date_fns_docs.json`\n\n### GitHub Releases\n\ndate-fns is available via [the releases page](https://github.com/date-fns/date-fns/releases)\nwhere you can download the source code or individual files.\n","type":"markdown","urlId":"Getting-Started","category":"General","title":"Getting Started","description":"Introduction & installation instructions","path":"/Users/lesha/Work/date-fns/docs/getting_started.md"},{"content":"# Change Log\n\nAll notable changes to this project will be documented in this file.\nThis project adheres to [Semantic Versioning].\n\nThis change log follows the format documented in [Keep a CHANGELOG].\n\n[Semantic Versioning]: http://semver.org/\n[Keep a CHANGELOG]: http://keepachangelog.com/\n\n## [Unreleased]\n\n## [1.20.0] - 2016-12-13\n\n### Added\n\n- `areRangesOverlapping` and `getOverlappingDayInRanges`\n Thanks to Joanna T [@asia-t](https://github.com/asia-t).\n See PR: [#331](https://github.com/date-fns/date-fns/pull/331)\n\n## [1.19.0] - 2016-12-13\n\n### Added\n\n- [Greek locale (el)](https://github.com/date-fns/date-fns/pull/334)\n (kudos to Theodoros Orfanidis [@teoulas](https://github.com/teoulas))\n\n- [Slovak locale (sk)](https://github.com/date-fns/date-fns/pull/336)\n (kudos to Marek Suscak [@mareksuscak](https://github.com/mareksuscak))\n\n- Add yarn support.\n Thanks to Uladzimir Havenchyk [@havenchyk](https://github.com/havenchyk).\n See PR: [#288](https://github.com/date-fns/date-fns/pull/288)\n\n## [1.18.0] - 2016-12-12\n\n### Added\n\n- [Turkish locale (tr)](https://github.com/date-fns/date-fns/pull/329)\n (kudos to Alpcan Aydın [@alpcanaydin](https://github.com/alpcanaydin))\n\n- [Korean locale (ko)](https://github.com/date-fns/date-fns/pull/327)\n (thanks to Hong Chulju [@angdev](https://github.com/angdev))\n\n### Fixed\n\n- `SS` and `SSS` formats in `format` are now correctly displayed with leading zeros.\n Thanks to Paul Dijou [@pauldijou](https://github.com/pauldijou).\n See PR: [#330](https://github.com/date-fns/date-fns/pull/330)\n\n## [1.17.0] - 2016-12-10\n\n### Added\n\n- [Polish locale (pl)](https://github.com/date-fns/date-fns/pull/294)\n (thanks to Mateusz Derks [@ertrzyiks](https://github.com/ertrzyiks))\n\n- [Portuguese locale (pt)](https://github.com/date-fns/date-fns/pull/316)\n (thanks to Dário Freire [@dfreire](https://github.com/dfreire))\n\n- [Swedish locale (sv)](https://github.com/date-fns/date-fns/pull/311)\n (thanks to Johannes Ulén [@ejulen](https://github.com/ejulen))\n\n- [French locale (fr)](https://github.com/date-fns/date-fns/pull/281)\n (thanks to Jean Dupouy [@izeau](https://github.com/izeau))\n\n- Performance tests. See PR: [#289](https://github.com/date-fns/date-fns/pull/289)\n\n### Fixed\n\n- Fix TypeScript and flow typings for `isValid`.\n See PR: [#310](https://github.com/date-fns/date-fns/pull/310)\n\n- Fix incorrect locale tests that could potentially lead to `format` bugs.\n Kudos to Mateusz Derks [@ertrzyiks](https://github.com/ertrzyiks).\n See related PRs: [#312](https://github.com/date-fns/date-fns/pull/312),\n [#320](https://github.com/date-fns/date-fns/pull/320)\n\n- Minor language fixes in the documentation.\n Thanks to Vedad Šoše [@vedadsose](https://github.com/vedadsose) ([#314](https://github.com/date-fns/date-fns/pull/314))\n and Asia [@asia-t](https://github.com/asia-t) ([#318](https://github.com/date-fns/date-fns/pull/318))\n\n### Changed\n\n- `format` now returns `String('Invalid Date')` if the passed date is invalid.\n See PR: [#323](https://github.com/date-fns/date-fns/pull/323)\n\n- `distanceInWords`, `distanceInWordsToNow`, `distanceInWordsStrict` and `format` functions now\n check if the passed locale is valid, and fallback to English locale otherwise.\n See PR: [#321](https://github.com/date-fns/date-fns/pull/321)\n\n- *Internal*: use a loop instead of `Object.keys` in `buildFormattingTokensRegExp`\n to improve compatibility with older browsers.\n See PR: [#322](https://github.com/date-fns/date-fns/pull/322)\n\n## [1.16.0] - 2016-12-08\n\n### Added\n\n- [Italian locale (it)](https://github.com/date-fns/date-fns/pull/298)\n (thanks to Alberto Restifo [@albertorestifo](https://github.com/albertorestifo))\n\n- For German `buildDistanceInWordsLocale`, add nominative case translations (for distances without a suffix).\n Kudos to Asia [@asia-t](https://github.com/asia-t).\n See related PR: [#295](https://github.com/date-fns/date-fns/pull/295)\n\n## [1.15.1] - 2016-12-07\n\n### Fixed\n\n- Fixed TypeScript imports from individual modules.\n Thanks to [@mattlewis92](https://github.com/mattlewis92).\n See related PR: [#287](https://github.com/date-fns/date-fns/pull/287)\n\n## [1.15.0] - 2016-12-07\n\n### Added\n\n- [Indonesian locale (id)](https://github.com/date-fns/date-fns/pull/299)\n (thanks to Rahmat Budiharso [@rbudiharso](https://github.com/rbudiharso))\n\n- [Catalan locale (ca)](https://github.com/date-fns/date-fns/pull/300)\n (thanks to Guillermo Grau [@guigrpa](https://github.com/guigrpa))\n\n### Fixed\n\n- Fix some inaccuracies in Spanish locale.\n Kudos to [@guigrpa](https://github.com/guigrpa).\n See related PR: [#302](https://github.com/date-fns/date-fns/pull/302)\n\n## [1.14.1] - 2016-12-06\n\n### Fixed\n\n- Fixed broken test for Norwegian Bokmål locale.\n\n## [1.14.0] - 2016-12-06\n\n### Added\n\n- [Norwegian Bokmål locale (nb)](https://github.com/date-fns/date-fns/pull/291)\n (thanks to Hans-Kristian Koren [@Hanse](https://github.com/Hanse))\n\n## [1.13.0] - 2016-12-06\n\n### Added\n\n- [Chinese Traditional locale (zh_tw)](https://github.com/date-fns/date-fns/pull/283)\n (thanks to tonypai [@tpai](https://github.com/tpai)).\n\n- [Dutch language locale (nl)](https://github.com/date-fns/date-fns/pull/278)\n (kudos to Jorik Tangelder [@jtangelder](https://github.com/jtangelder))\n\n## [1.12.1] - 2016-12-05\n\n### Fixed\n\n- Added `distanceInWordsStrict` to the list of supported functions in I18n doc.\n\n## [1.12.0] - 2016-12-05\n\n### Added\n\n- [Spanish language locale (es)](https://github.com/date-fns/date-fns/pull/269)\n (thanks to Juan Angosto [@juanangosto](https://github.com/juanangosto)).\n\n### Fixed\n\n- Fix flow typings for some of the functions.\n See PR: [#273](https://github.com/date-fns/date-fns/pull/273)\n\n## [1.11.2] - 2016-11-28\n\n### Fixed\n\n- Bug in `parse` when it sometimes parses ISO week-numbering dates incorrectly.\n See PR: [#262](https://github.com/date-fns/date-fns/pull/262)\n\n- Bug in some functions which caused them to handle dates earlier than 100 AD incorrectly.\n See PR: [#263](https://github.com/date-fns/date-fns/pull/263)\n\n## [1.11.1] - 2016-11-24\n\n### Fixed\n\n- Include TypeScript typings with npm package.\n\n## [1.11.0] - 2016-11-23\n\n### Added\n\n- `distanceInWordsStrict`.\n Kudos to [@STRML](https://github.com/STRML).\n See related PR: [#254](https://github.com/date-fns/date-fns/pull/254)\n\n- [TypeScript](https://www.typescriptlang.org/) typings for all functions.\n Kudos to [@mattlewis92](https://github.com/mattlewis92).\n See related PR: [#255](https://github.com/date-fns/date-fns/pull/255)\n\n## [1.10.0] - 2016-11-01\n\n### Added\n\n- `parse` now can parse dates that are ISO 8601 centuries (e.g., `19` and `+0019`).\n\n ```javascript\n var result = parse('19')\n //=> Mon Jan 01 1900 00:00:00\n ```\n\n- In `parse`, added ability to specify the number of additional digits\n for extended year or century format (possible values are 0, 1 or 2; default is 2).\n\n ```javascript\n parse('+002016-11-01')\n parse('+02016-11-01', {additionalDigits: 1})\n parse('+2016-11-01', {additionalDigits: 0})\n ```\n\n## [1.9.0] - 2016-10-25\n\n### Added\n\n- Got index.js imports to work with SystemJS.\n\n## [1.8.1] - 2016-10-24\n\n### Fixed\n\n- Added Japanese and German language locales to the list in I18n doc.\n\n## [1.8.0] - 2016-10-23\n\n### Added\n\n- [Japanese language locale (ja)](https://github.com/date-fns/date-fns/pull/241)\n (thanks to Thomas Eilmsteiner [@DeMuu](https://github.com/DeMuu) again!)\n\n- `getISODay`\n\n- `setISODay`\n\n## [1.7.0] - 2016-10-20\n\n### Added\n\n- [German language locale (de)](https://github.com/date-fns/date-fns/pull/237)\n (thanks to Thomas Eilmsteiner [@DeMuu](https://github.com/DeMuu)).\n\n## [1.6.0] - 2016-10-16\n\n### Added\n\n- [Chinese Simplified locale (zh_cn)](https://github.com/date-fns/date-fns/pull/235)\n (kudos to Changyu [@KingMario](https://github.com/KingMario) Geng).\n\n## [1.5.2] - 2016-10-13\n\n### Fixed\n\n- Incorrectly generated docs for `format`.\n\n- Fixed typo in I18n doc.\n\n## [1.5.1] - 2016-10-12\n\n### Fixed\n\n- A change log entry for [1.5.0] is added.\n\n## [1.5.0] - 2016-10-12\n\n### Added\n\n- [The initial I18n support](https://date-fns.org/docs/I18n)\n\n## [1.4.0] - 2016-10-09\n\n### Added\n\n- Basic [SystemJS](https://github.com/systemjs/systemjs) support.\n\n### Fixed\n\n- Fix incorrect behaviour of `YYYY` and `YY` for years prior to 1000:\n now `format(new Date('0001-01-01'), 'YYYY-MM-DD')` returns `0001-01-01`\n instead of `1-01-01`.\n\n## [1.3.0] - 2016-05-26\n\n### Added\n\n- `closestIndexTo`\n\n## [1.2.0] - 2016-05-23\n\n### Added\n\n- Add an ability to pass negative numbers to `setDay`.\n\n## [1.1.1] - 2016-05-19\n\n### Fixed\n\n- Fix [Flow](http://flowtype.org/) declarations for some of the functions.\n\n## [1.1.0] - 2016-05-19\n\n### Added\n\n- [Flow](http://flowtype.org/) declarations for each function\n in [the \".js.flow\" style](http://flowtype.org/docs/declarations.html#declaration-files).\n Kudos to [@JohnyDays](https://github.com/JohnyDays). See related PRs:\n\n - [#205](https://github.com/date-fns/date-fns/pull/205)\n\n - [#207](https://github.com/date-fns/date-fns/pull/207)\n\n## [1.0.0] - 2016-05-18\n\n### Fixed\n\n- `format` now returns the correct result for key `E`.\n\n- Prevent `startOf...`, `endOf...` and `lastDayOf...` functions\n to return dates with an incorrect time when the date is modifying\n into another time zone.\n\n- `parse` now parses years from 1 AD to 99 AD correctly.\n\n- Fix a bug in `getISOWeek` appearing because of a changing time zone\n (e.g., when the given date is in DST and the start of the ISO year is not).\n\n### Changed\n\n- **BREAKING**: all functions are moved to the root of the library, so they\n are now accessible with `require('date-fns/name_of_function')` or\n `import nameOfFunction from 'date-fns/name_of_function'`.\n\n ```javascript\n // Before v1.0.0\n var addMonths = require('date-fns/src/add_months')\n\n // v1.0.0 onward\n var addMonths = require('date-fns/add_months')\n ```\n\n- **BREAKING**: functions that had the last optional argument `weekStartsAt`\n (i.e. `endOfWeek`, `isSameWeek`, `lastDayOfWeek`, `setDay`, `startOfWeek`)\n now instead receive the object `options` with the property `options.weekStartsOn`\n as the last argument.\n\n ```javascript\n // Before v1.0.0\n var result = endOfWeek(new Date(2014, 8, 2), 1)\n\n // v1.0.0 onward\n var result = endOfWeek(new Date(2014, 8, 2), {weekStartsOn: 1})\n ```\n\n- **BREAKING**: remove the function `getTimeSinceMidnight` that was used inside\n the other functions.\n\n- **BREAKING**: `differenceInDays` now returns the number of full days instead\n of calendar days.\n\n- **BREAKING**: `eachDay` and `isWithinRange` now throw an exception\n when the given range boundaries are invalid.\n\n- Faster `isLeapYear`.\n\n- *Internal*: make the documentation more verbose.\n\n- *Internal*: convert the tests from Chai to power-assert allowing them\n to run against IE8.\n\n### Added\n\n- `addISOYears`\n\n- `closestTo`\n\n- `differenceInCalendarDays`\n\n- `differenceInCalendarISOWeeks`\n\n- `differenceInCalendarISOYears`\n\n- `differenceInCalendarMonths`\n\n- `differenceInCalendarQuarters`\n\n- `differenceInCalendarWeeks`\n\n- `differenceInCalendarYears`\n\n- `differenceInHours`\n\n- `differenceInISOYears`\n\n- `differenceInMilliseconds`\n\n- `differenceInMinutes`\n\n- `differenceInMonths`\n\n- `differenceInQuarters`\n\n- `differenceInSeconds`\n\n- `differenceInWeeks`\n\n- `differenceInYears`\n\n- `distanceInWords`\n\n- `distanceInWordsToNow`\n\n- `endOfISOWeek`\n\n- `endOfISOYear`\n\n- `endOfToday`\n\n- `endOfTomorrow`\n\n- `endOfYesterday`\n\n- `getDaysInYear`\n\n- `isDate`\n\n- `isFriday`\n\n- `isMonday`\n\n- `isSameISOWeek`\n\n- `isSameISOYear`\n\n- `isSaturday`\n\n- `isSunday`\n\n- `isThisHour`\n\n- `isThisISOWeek`\n\n- `isThisISOYear`\n\n- `isThisMinute`\n\n- `isThisMonth`\n\n- `isThisQuarter`\n\n- `isThisSecond`\n\n- `isThisWeek`\n\n- `isThisYear`\n\n- `isThursday`\n\n- `isTomorrow`\n\n- `isTuesday`\n\n- `isValid`\n\n- `isWednesday`\n\n- `isYesterday`\n\n- `lastDayOfISOWeek`\n\n- `lastDayOfISOYear`\n\n- `startOfISOWeek`\n\n- `startOfToday`\n\n- `startOfTomorrow`\n\n- `startOfYesterday`\n\n- `subISOYears`\n\n- Add `Qo`, `W`, `Wo`, `WW`, `GG`, `GGGG`, `Z`, `ZZ`, `X`, `x` keys to `format`.\n\n## [0.17.0] - 2015-09-29\n\n### Fixed\n\n- Fix a lot of bugs appearing when date is modifying into other time zone\n (e.g., when adding months and original date is in DST but new date is not).\n\n- Prevent instances of Date to lose milliseconds value when passed to.\n `parse` in IE10.\n\n### Changed\n\n- `setISOWeek` now keeps time from original date.\n\n- *Internal*: reuse `getDaysInMonth` inside of `addMonths`.\n\n### Added\n\n- `differenceInDays`\n\n- `getTimeSinceMidnight`\n\n- `format` now has new format key `aa`, which returns `a.m.`/`p.m.`\n as opposed to `a` that returns `am`/`pm`.\n\n- Complete UMD package (for Bower and CDN).\n\n## [0.16.0] - 2015-09-01\n\n### Changed\n\n- Use `parse` to clean date arguments in all functions.\n\n- `parse` now fallbacks to `new Date` when the argument\n is not an ISO formatted date.\n\n- *Internal*: reuse `getDaysInMonth` inside of `setMonth`.\n\n### Added\n\n- `addQuarters`\n\n- `addWeeks`\n\n- `endOfQuarter`\n\n- `getDate`\n\n- `getDay`\n\n- `getDaysInMonth`\n\n- `getHours`\n\n- `getISOWeeksInYear`\n\n- `getMilliseconds`\n\n- `getMinutes`\n\n- `getMonth`\n\n- `getSeconds`\n\n- `getYear`\n\n- `isLeapYear`\n\n- `isSameHour`\n\n- `isSameMinute`\n\n- `isSameQuarter`\n\n- `isSameSecond`\n\n- `lastDayOfQuarter`\n\n- `lastDayOfWeek`\n\n- `max`\n\n- `min`\n\n- `setDate`\n\n- `setDay`\n\n- `setHours`\n\n- `setMilliseconds`\n\n- `setMinutes`\n\n- `setSeconds`\n\n- `startOfQuarter`\n\n- `subQuarters`\n\n- `subWeeks`\n\n## [0.15.0] - 2015-08-26\n\n### Changed\n\n- `format` now returns `a.m.`/`p.m.` instead of `am`/`pm`.\n\n- `setMonth` now sets last day of month if original date was last day\n of longer month.\n\n- *Internal*: Fix code style according to ESLint.\n\n- *Internal*: Make tests run through all time zones.\n\n### Added\n\n- `getQuarter`\n\n- `setQuarter`\n\n- `getDayOfYear`\n\n- `setDayOfYear`\n\n- `isPast`\n\n- `addSeconds`\n\n- `subSeconds`\n\n- `startOfSecond`\n\n- `endOfSecond`\n\n- `startOfMinute`\n\n- `endOfMinute`\n\n- `addMilliseconds`\n\n- `subMilliseconds`\n\n- `endOfYear`\n\n- `addYears`\n\n- `subYears`\n\n- `lastDayOfYear`\n\n- `lastDayOfMonth`\n\n## [0.14.11] - 2015-08-21\n\n### Fixed\n\n- `format` now uses `parse` to avoid time zone bugs.\n\n### Changed\n\n- `setIsoWeek` now sets time to the start of the day.\n\n## [0.14.10] - 2015-07-29\n\n### Fixed\n\n- `format` now behaves correctly with 12:00 am.\n\n- `format` now behaves correctly with ordinal numbers.\n\n### Added\n\n- `compareAsc`\n\n- `compareDesc`\n\n- `addHours`\n\n- `subHours`\n\n- `isSameDay`\n\n- `parse`\n\n- `getISOYear`\n\n- `setISOYear`\n\n- `startOfISOYear`\n\n- `getISOWeek`\n\n- `setISOWeek`\n\n## [0.14.9] - 2015-01-14\n\n### Fixed\n\n- `addMonths` now correctly behaves with February\n (see [#18](https://github.com/js-fns/date-fns/pull/18)).\n\n## [0.14.8] - 2014-12-25\n\n### Fixed\n\n- `format` function now behaves correctly with `pm`/`am`.\n\n## [0.14.6] - 2014-12-04\n\n### Fixed\n\n- Fix broken Bower support.\n\n## [0.14.0] - 2014-11-05\n\n### Added\n\n- Bower package.\n\n## [0.13.0] - 2014-10-22\n\n### Added\n\n- `addMinutes`\n\n- `subMinutes`\n\n- `isEqual`\n\n- `isBefore`\n\n- `isAfter`\n\n## [0.12.1] - 2014-10-19\n\n### Fixed\n\n- Incorrect rounding in `DDD` formatter.\n\n## [0.12.0] - 2014-10-15\n\n### Added\n\n- `isSameYear`\n\n## [0.11.0] - 2014-10-15\n\n### Added\n\n- `isWithinRange`\n\n## [0.10.0] - 2014-10-13\n\n### Added\n\n- `format`\n\n- `startOfYear`\n\n## [0.9.0] - 2014-10-10\n\n### Changed\n\n- *Internal*: simplify `isWeekend`\n\n### Added\n\n- `isFuture`\n\n## [0.8.0] - 2014-10-09\n\n### Changed\n\n- *Internal*: reuse `addDays` inside of `subDays`.\n\n### Added\n\n- `addMonths`\n\n- `subMonths`\n\n- `setMonth`\n\n- `setYear`\n\n## [0.7.0] - 2014-10-08\n\n### Added\n\n- `isSameWeek`\n\n## [0.6.0] - 2014-10-07\n\n### Fixed\n\n- Inconsistent behavior of `endOfMonth`.\n\n### Added\n\n- `isFirstDayOfMonth`\n\n- `isLastDayOfMonth`\n\n- `isSameMonth`\n\n## [0.5.0] - 2014-10-07\n\n### Added\n\n- `addDays`\n\n- `subDays`\n\n## [0.4.0] - 2014-10-07\n\n### Added\n\n- `startOfWeek`\n\n- `endOfWeek`\n\n- `eachDay`\n\n## [0.3.0] - 2014-10-06\n\n### Changed\n\n- `startOfDay` now sets milliseconds as well.\n\n### Added\n\n- `endOfDay`\n\n- `startOfMonth`\n\n- `endOfMonth`\n\n## [0.2.0] - 2014-10-06\n\n### Added\n\n- `isToday`\n\n- `isWeekend`\n\n## 0.1.0 - 2014-10-06\n\n### Added\n\n- `startOfDay`\n\n[Unreleased]: https://github.com/date-fns/date-fns/compare/v1.20.0...HEAD\n[1.20.0]: https://github.com/date-fns/date-fns/compare/v1.19.0...v1.20.0\n[1.19.0]: https://github.com/date-fns/date-fns/compare/v1.18.0...v1.19.0\n[1.18.0]: https://github.com/date-fns/date-fns/compare/v1.17.0...v1.18.0\n[1.17.0]: https://github.com/date-fns/date-fns/compare/v1.16.0...v1.17.0\n[1.16.0]: https://github.com/date-fns/date-fns/compare/v1.15.1...v1.16.0\n[1.15.1]: https://github.com/date-fns/date-fns/compare/v1.15.0...v1.15.1\n[1.15.0]: https://github.com/date-fns/date-fns/compare/v1.14.1...v1.15.0\n[1.14.1]: https://github.com/date-fns/date-fns/compare/v1.14.0...v1.14.1\n[1.14.0]: https://github.com/date-fns/date-fns/compare/v1.13.0...v1.14.0\n[1.13.0]: https://github.com/date-fns/date-fns/compare/v1.12.1...v1.13.0\n[1.12.1]: https://github.com/date-fns/date-fns/compare/v1.12.0...v1.12.1\n[1.12.0]: https://github.com/date-fns/date-fns/compare/v1.11.2...v1.12.0\n[1.11.2]: https://github.com/date-fns/date-fns/compare/v1.11.1...v1.11.2\n[1.11.1]: https://github.com/date-fns/date-fns/compare/v1.11.0...v1.11.1\n[1.11.0]: https://github.com/date-fns/date-fns/compare/v1.10.0...v1.11.0\n[1.10.0]: https://github.com/date-fns/date-fns/compare/v1.9.0...v1.10.0\n[1.9.0]: https://github.com/date-fns/date-fns/compare/v1.8.1...v1.9.0\n[1.8.1]: https://github.com/date-fns/date-fns/compare/v1.8.0...v1.8.1\n[1.8.0]: https://github.com/date-fns/date-fns/compare/v1.7.0...v1.8.0\n[1.7.0]: https://github.com/date-fns/date-fns/compare/v1.6.0...v1.7.0\n[1.6.0]: https://github.com/date-fns/date-fns/compare/v1.5.2...v1.6.0\n[1.5.2]: https://github.com/date-fns/date-fns/compare/v1.5.1...v1.5.2\n[1.5.1]: https://github.com/date-fns/date-fns/compare/v1.5.0...v1.5.1\n[1.5.0]: https://github.com/date-fns/date-fns/compare/v1.4.0...v1.5.0\n[1.4.0]: https://github.com/date-fns/date-fns/compare/v1.3.0...v1.4.0\n[1.3.0]: https://github.com/date-fns/date-fns/compare/v1.2.0...v1.3.0\n[1.2.0]: https://github.com/date-fns/date-fns/compare/v1.1.1...v1.2.0\n[1.1.1]: https://github.com/date-fns/date-fns/compare/v1.1.0...v1.1.1\n[1.1.0]: https://github.com/date-fns/date-fns/compare/v1.0.0...v1.1.0\n[1.0.0]: https://github.com/date-fns/date-fns/compare/v0.17.0...v1.0.0\n[0.17.0]: https://github.com/date-fns/date-fns/compare/v0.16.0...v0.17.0\n[0.16.0]: https://github.com/date-fns/date-fns/compare/v0.15.0...v0.16.0\n[0.15.0]: https://github.com/date-fns/date-fns/compare/v0.14.11...v0.15.0\n[0.14.11]: https://github.com/date-fns/date-fns/compare/v0.14.10...v0.14.11\n[0.14.10]: https://github.com/date-fns/date-fns/compare/v0.14.9...v0.14.10\n[0.14.9]: https://github.com/date-fns/date-fns/compare/v0.14.8...v0.14.9\n[0.14.8]: https://github.com/date-fns/date-fns/compare/v0.14.6...v0.14.8\n[0.14.6]: https://github.com/date-fns/date-fns/compare/v0.14.0...v0.14.6\n[0.14.0]: https://github.com/date-fns/date-fns/compare/v0.13.0...v0.14.0\n[0.13.0]: https://github.com/date-fns/date-fns/compare/v0.12.1...v0.13.0\n[0.12.1]: https://github.com/date-fns/date-fns/compare/v0.12.0...v0.12.1\n[0.12.0]: https://github.com/date-fns/date-fns/compare/v0.11.0...v0.12.0\n[0.11.0]: https://github.com/date-fns/date-fns/compare/v0.10.0...v0.11.0\n[0.10.0]: https://github.com/date-fns/date-fns/compare/v0.9.0...v0.10.0\n[0.9.0]: https://github.com/date-fns/date-fns/compare/v0.8.0...v0.9.0\n[0.8.0]: https://github.com/date-fns/date-fns/compare/v0.7.0...v0.8.0\n[0.7.0]: https://github.com/date-fns/date-fns/compare/v0.6.0...v0.7.0\n[0.6.0]: https://github.com/date-fns/date-fns/compare/v0.5.0...v0.6.0\n[0.5.0]: https://github.com/date-fns/date-fns/compare/v0.4.0...v0.5.0\n[0.4.0]: https://github.com/date-fns/date-fns/compare/v0.3.0...v0.4.0\n[0.3.0]: https://github.com/date-fns/date-fns/compare/v0.2.0...v0.3.0\n[0.2.0]: https://github.com/date-fns/date-fns/compare/v0.1.0...v0.2.0\n","type":"markdown","urlId":"Change-Log","category":"General","title":"Change Log","description":"Changes for each version of the library","path":"/Users/lesha/Work/date-fns/CHANGELOG.md"},{"content":"# Contributing Guide\n\n## Table of Contents\n\n- [How to Help?](#how-to-help)\n\n- [Contribution Guidelines](#contribution-guidelines)\n\n- [Getting Started](#getting-started)\n\n- [Code Style Guide](#code-style-guide)\n\n - [Lint the Code](#lint-the-code)\n\n - [Use EditorConfig](#use-editorconfig)\n\n- [Documentation](#documentation)\n\n - [JSDoc](#jsdoc)\n\n## How to Help?\n\nHelp is always welcome. There are areas where you can help:\n\n- The core functionality (performance improvements, bug fixes,\n new features, etc.).\n\n- Documentation ([markdown documents](https://github.com/date-fns/date-fns/search?l=markdown),\n inline JSDoc comments).\n\n- Test suite & development environment improvements.\n\n- The [website](https://github.com/date-fns/date-fns.org).\n\nIf you see a gap, but don't have time, experience, or you just need help\nwith the library, don't hesitate to [shoot an issue](https://github.com/date-fns/date-fns/issues/new).\n\nThe date-fns functionality is comprehensive and covers most of the use cases,\nhowever it doesn't have extended time zone support. Please leave a comment\nto the [Extended time zones support issue](https://github.com/date-fns/date-fns/issues/180)\nif you are interested in the functionality or want to help with development.\n\nIf you are interested in Elm/ClojureScript/etc. wrappers,\nplease [file an issue](https://github.com/date-fns/date-fns/issues/new).\n\n## Contribution Guidelines\n\nDue to the modular nature of date-fns, it's more than open to new features.\nHowever, when a new function duplicates the existing functionality, native API\nor causes significant build size increase, a PR might be rejected or\nthe author can be asked to move the code to a new or another package.\n\nPlease follow the main contributing rules, to maintain date-fns' top quality:\n\n- Follow style guides:\n\n - [Lint the code](#lint-the-code).\n\n - [Use EditorConfig](#use-editorconfig).\n\n- Write tests.\n\n- [Write documentation](#documentation).\n\n- [Write good commit messages].\n\n- Add an entry to Unreleased section in [CHANGELOG].\n\n- Squash related commits before a PR merge.\n\n- Don't change the library version.\n\n[Write good commit messages]: http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html\n[CHANGELOG]: https://github.com/date-fns/date-fns/blob/master/CHANGELOG.md\n\n## Getting Started\n\n1. [Install Node.js](https://nodejs.org/en/download).\n\n2. Fork the project and clone the fork repo.\n\n3. Run `yarn` or `npm install` to install the application dependencies\n\n## Code Style Guide\n\n### Lint the Code\n\nThe project follows [JavaScript Standard Style]. To lint the code, run:\n\n```bash\nnpm run lint\n# or\nyarn run lint\n```\n\n[JavaScript Standard Style]: http://standardjs.com/\n\n### Use EditorConfig\n\nThe project uses [EditorConfig] to define basic coding style guides.\nPlease install a plugin for your editor of choice or manually enforce\nthe rules listed in [.editorconfig].\n\n[EditorConfig]: http://editorconfig.org\n[.editorconfig]: https://github.com/date-fns/date-fns.org/blob/master/.editorconfig\n\n## Documentation\n\n### JSDoc\n\n[JSDoc](http://usejsdoc.org) is used for the code documentation. Along with\nstandard JSDoc tags, date-fns uses `@category` tag that allows\nto group functions.\n\n[jsdoc-parse](https://github.com/jsdoc2md/jsdoc-parse) is used to generate\n[documentation JSON](https://github.com/date-fns/date-fns/blob/master/dist/date_fns_docs.json)\nconsumed by [date-fns.org](https://date-fns.org/docs).\n","type":"markdown","urlId":"Contributing","category":"General","title":"Contributing","description":"Contribution manual","path":"/Users/lesha/Work/date-fns/CONTRIBUTING.md"},{"content":"# Internationalization\n\n## Table of Contents\n\n- [Usage](#usage)\n\n- [Supported Languages](#supported-languages)\n\n- [Adding New Language](#adding-new-language)\n\n## Usage\n\n**Important! Note that non-CommonJS packages (Bower, CDN)\ndon't support I18 yet.** Please [vote for the issue](https://github.com/date-fns/date-fns/issues/232)\nif you want to make it happen.\n\nThere are just a few functions that support I18n:\n\n- [`format`](https://date-fns.org/docs/format)\n- [`distanceInWords`](https://date-fns.org/docs/distanceInWords)\n- [`distanceInWordsToNow`](https://date-fns.org/docs/distanceInWordsToNow)\n- [`distanceInWordsStrict`](https://date-fns.org/docs/distanceInWordsStrict)\n\nTo use a locale, you need to require it and then pass\nas an option to a function:\n\n```js\nvar distanceInWords = require('date-fns/distance_in_words')\n// Require Esperanto locale\nvar eoLocale = require('date-fns/locale/eo')\n\nvar result = distanceInWords(\n new Date(2016, 7, 1),\n new Date(2015, 0, 1),\n {locale: eoLocale} // Pass the locale as an option\n)\n//=> 'pli ol 1 jaro'\n```\n\nIt might seem complicated to require and pass locales as options,\nbut unlike Moment.js which bloats your build with all the locales\nby default date-fns forces developer to manually require locales when needed.\nTo make API simple, we encourage you to write tiny wrappers and use those\ninstead of original functions:\n\n```js\n// app/_lib/format.js\n\nvar format = require('date-fns/format')\n\nvar locales = {\n en: require('date-fns/locale/en'),\n eo: require('date-fns/locale/eo'),\n ru: require('date-fns/locale/ru')\n}\n\nmodule.exports = function (date, formatStr) {\n return format(date, formatStr, {\n locale: locales[window.__localeId__] // or global.__localeId__\n })\n}\n\n// Later:\n\nvar format = require('app/_lib/format')\n\nwindow.__localeId__ = 'en'\nformat(friday13, 'dddd D')\n//=> 'Friday 13'\n\nwindow.__localeId__ = 'eo'\nformat(friday13, 'dddd D')\n//=> 'vendredo 13'\n```\n\n## Supported Languages\n\ndate-fns currently supports:\n\n1. [English](https://github.com/date-fns/date-fns/tree/master/src/locale/en)\n (`en`; it's the built-in language and doesn't require any setup)\n2. [Russian](https://github.com/date-fns/date-fns/tree/master/src/locale/ru) (`ru`)\n3. [Esperanto](https://github.com/date-fns/date-fns/tree/master/src/locale/eo) (`eo`)\n4. [Chinese Simplified](https://github.com/date-fns/date-fns/tree/master/src/locale/zh_cn)\n (`zh_cn`; kudos to Changyu Geng [@KingMario](https://github.com/KingMario))\n5. [German](https://github.com/date-fns/date-fns/tree/master/src/locale/de)\n (`de`; kudos to Thomas Eilmsteiner [@DeMuu](https://github.com/DeMuu)\n and Asia [@asia-t](https://github.com/asia-t))\n6. [Japanese](https://github.com/date-fns/date-fns/tree/master/src/locale/ja)\n (`ja`; kudos to Thomas Eilmsteiner [@DeMuu](https://github.com/DeMuu))\n7. [Spanish](https://github.com/date-fns/date-fns/tree/master/src/locale/es)\n (`es`; kudos to Juan Angosto [@juanangosto](https://github.com/juanangosto)\n and Guillermo Grau [@guigrpa](https://github.com/guigrpa))\n8. [Dutch](https://github.com/date-fns/date-fns/tree/master/src/locale/nl)\n (`nl`; kudos to Jorik Tangelder [@jtangelder](https://github.com/jtangelder))\n9. [Chinese Traditional](https://github.com/date-fns/date-fns/tree/master/src/locale/zh_tw)\n (`zh_tw`; kudos to tonypai [@tpai](https://github.com/tpai))\n10. [Norwegian Bokmål](https://github.com/date-fns/date-fns/tree/master/src/locale/nb)\n (`nb`; kudos to Hans-Kristian Koren [@Hanse](https://github.com/Hanse))\n11. [Catalan](https://github.com/date-fns/date-fns/tree/master/src/locale/ca)\n (`ca`; kudos to Guillermo Grau [@guigrpa](https://github.com/guigrpa))\n12. [Indonesian](https://github.com/date-fns/date-fns/tree/master/src/locale/id)\n (`id`; kudos to Rahmat Budiharso [@rbudiharso](https://github.com/rbudiharso))\n13. [Italian](https://github.com/date-fns/date-fns/tree/master/src/locale/it)\n (`it`; kudos to Alberto Restifo [@albertorestifo](https://github.com/albertorestifo))\n14. [Polish](https://github.com/date-fns/date-fns/tree/master/src/locale/pl)\n (`pl`; kudos to Mateusz Derks [@ertrzyiks](https://github.com/ertrzyiks))\n15. [Portuguese](https://github.com/date-fns/date-fns/tree/master/src/locale/pt)\n (`pt`; kudos to Dário Freire [@dfreire](https://github.com/dfreire))\n16. [Swedish](https://github.com/date-fns/date-fns/tree/master/src/locale/sv)\n (`sv`; kudos to Johannes Ulén [@ejulen](https://github.com/ejulen))\n17. [French](https://github.com/date-fns/date-fns/tree/master/src/locale/fr)\n (`fr`; kudos to Jean Dupouy [@izeau](https://github.com/izeau))\n18. [Turkish](https://github.com/date-fns/date-fns/tree/master/src/locale/tr)\n (`tr`; kudos to Alpcan Aydın [@alpcanaydin](https://github.com/alpcanaydin))\n19. [Korean](https://github.com/date-fns/date-fns/tree/master/src/locale/ko)\n (`ko`; kudos to Hong Chulju [@angdev](https://github.com/angdev))\n20. [Greek](https://github.com/date-fns/date-fns/tree/master/src/locale/el)\n (`el`; kudos to Theodoros Orfanidis [@teoulas](https://github.com/teoulas))\n21. [Slovak](https://github.com/date-fns/date-fns/tree/master/src/locale/sk)\n (`sk`; kudos to Marek Suscak [@mareksuscak](https://github.com/mareksuscak))\n\nMore is coming, help is welcome!\n\n## Adding New Language\n\nAt the moment there is no definitive guide, so if you feel brave enough,\nuse this quick guide:\n\n- First of all, [create an issue](https://github.com/date-fns/date-fns/issues/new?title=XXX%20language%20support&labels[]=I18n)\n so you won't overlap with others.\n- Use [English locale](https://github.com/date-fns/date-fns/tree/master/src/locale/en)\n as the basis and then incrementally adjust the tests and the code.\n- If you have questions or need guidance, leave a comment in the issue.\n\nThank you for your support!\n","type":"markdown","urlId":"I18n","category":"General","title":"I18n","description":"Internationalization","path":"/Users/lesha/Work/date-fns/docs/i18n.md"},{"content":"# License\n\ndate-fns is licensed under the [MIT license](http://kossnocorp.mit-license.org).\nRead more about MIT at [TLDRLegal](https://tldrlegal.com/license/mit-license).\n","type":"markdown","urlId":"License","category":"General","title":"License","description":"MIT © Sasha Koss","path":"/Users/lesha/Work/date-fns/LICENSE.md"}],"Common Helpers":[{"type":"jsdoc","urlId":"closestIndexTo","category":"Common Helpers","title":"closestIndexTo","description":"Return an index of the closest date from the array comparing to the given date.","content":{"id":"closestIndexTo","longname":"closestIndexTo","name":"closestIndexTo","scope":"global","kind":"function","description":"Return an index of the closest date from the array comparing to the given date.","params":[{"type":{"names":["Date","String","Number"]},"description":"the date to compare with","name":"dateToCompare"},{"type":{"names":["Array.<Date>","Array.<String>","Array.<Number>"]},"description":"the array to search","name":"datesArray"}],"examples":["// Which date is closer to 6 September 2015?\nvar dateToCompare = new Date(2015, 8, 6)\nvar datesArray = [\n new Date(2015, 0, 1),\n new Date(2016, 0, 1),\n new Date(2017, 0, 1)\n]\nvar result = closestIndexTo(dateToCompare, datesArray)\n//=> 1"],"returns":[{"type":{"names":["Number"]},"description":"an index of the date closest to the given date"}],"category":"Common Helpers","exceptions":[{"type":{"names":["TypeError"]},"description":"the second argument must be an instance of Array"}],"meta":{"lineno":26,"filename":"index.js","path":"/Users/lesha/Work/date-fns/src/closest_index_to"},"summary":"Return an index of the closest date from the array comparing to the given date.","order":0}},{"type":"jsdoc","urlId":"closestTo","category":"Common Helpers","title":"closestTo","description":"Return a date from the array closest to the given date.","content":{"id":"closestTo","longname":"closestTo","name":"closestTo","scope":"global","kind":"function","description":"Return a date from the array closest to the given date.","params":[{"type":{"names":["Date","String","Number"]},"description":"the date to compare with","name":"dateToCompare"},{"type":{"names":["Array.<Date>","Array.<String>","Array.<Number>"]},"description":"the array to search","name":"datesArray"}],"examples":["// Which date is closer to 6 September 2015: 1 January 2000 or 1 January 2030?\nvar dateToCompare = new Date(2015, 8, 6)\nvar result = closestTo(dateToCompare, [\n new Date(2000, 0, 1),\n new Date(2030, 0, 1)\n])\n//=> Tue Jan 01 2030 00:00:00"],"returns":[{"type":{"names":["Date"]},"description":"the date from the array closest to the given date"}],"category":"Common Helpers","exceptions":[{"type":{"names":["TypeError"]},"description":"the second argument must be an instance of Array"}],"meta":{"lineno":24,"filename":"index.js","path":"/Users/lesha/Work/date-fns/src/closest_to"},"summary":"Return a date from the array closest to the given date.","order":0}},{"type":"jsdoc","urlId":"compareAsc","category":"Common Helpers","title":"compareAsc","description":"Compare the two dates and return -1, 0 or 1.","content":{"id":"compareAsc","longname":"compareAsc","name":"compareAsc","scope":"global","kind":"function","description":"Compare the two dates and return 1 if the first date is after the second,\n-1 if the first date is before the second or 0 if dates are equal.","params":[{"type":{"names":["Date","String","Number"]},"description":"the first date to compare","name":"dateLeft"},{"type":{"names":["Date","String","Number"]},"description":"the second date to compare","name":"dateRight"}],"examples":["// Compare 11 February 1987 and 10 July 1989:\nvar result = compareAsc(\n new Date(1987, 1, 11),\n new Date(1989, 6, 10)\n)\n//=> -1","// Sort the array of dates:\nvar result = [\n new Date(1995, 6, 2),\n new Date(1987, 1, 11),\n new Date(1989, 6, 10)\n].sort(compareAsc)\n//=> [\n// Wed Feb 11 1987 00:00:00,\n// Mon Jul 10 1989 00:00:00,\n// Sun Jul 02 1995 00:00:00\n// ]"],"returns":[{"type":{"names":["Number"]},"description":"the result of the comparison"}],"category":"Common Helpers","meta":{"lineno":36,"filename":"index.js","path":"/Users/lesha/Work/date-fns/src/compare_asc"},"summary":"Compare the two dates and return -1, 0 or 1.","order":0}},{"type":"jsdoc","urlId":"compareDesc","category":"Common Helpers","title":"compareDesc","description":"Compare the two dates reverse chronologically and return -1, 0 or 1.","content":{"id":"compareDesc","longname":"compareDesc","name":"compareDesc","scope":"global","kind":"function","description":"Compare the two dates and return -1 if the first date is after the second,\n1 if the first date is before the second or 0 if dates are equal.","params":[{"type":{"names":["Date","String","Number"]},"description":"the first date to compare","name":"dateLeft"},{"type":{"names":["Date","String","Number"]},"description":"the second date to compare","name":"dateRight"}],"examples":["// Compare 11 February 1987 and 10 July 1989 reverse chronologically:\nvar result = compareDesc(\n new Date(1987, 1, 11),\n new Date(1989, 6, 10)\n)\n//=> 1","// Sort the array of dates in reverse chronological order:\nvar result = [\n new Date(1995, 6, 2),\n new Date(1987, 1, 11),\n new Date(1989, 6, 10)\n].sort(compareDesc)\n//=> [\n// Sun Jul 02 1995 00:00:00,\n// Mon Jul 10 1989 00:00:00,\n// Wed Feb 11 1987 00:00:00\n// ]"],"returns":[{"type":{"names":["Number"]},"description":"the result of the comparison"}],"category":"Common Helpers","meta":{"lineno":36,"filename":"index.js","path":"/Users/lesha/Work/date-fns/src/compare_desc"},"summary":"Compare the two dates reverse chronologically and return -1, 0 or 1.","order":0}},{"type":"jsdoc","urlId":"distanceInWords","category":"Common Helpers","title":"distanceInWords","description":"Return the distance between the given dates in words.","content":{"id":"distanceInWords","longname":"distanceInWords","name":"distanceInWords","scope":"global","kind":"function","description":"Return the distance between the given dates in words.\n\n| Distance between dates | Result |\n|-------------------------------------------------------------------|---------------------|\n| 0 ... 30 secs | less than a minute |\n| 30 secs ... 1 min 30 secs | 1 minute |\n| 1 min 30 secs ... 44 mins 30 secs | [2..44] minutes |\n| 44 mins ... 30 secs ... 89 mins 30 secs | about 1 hour |\n| 89 mins 30 secs ... 23 hrs 59 mins 30 secs | about [2..24] hours |\n| 23 hrs 59 mins 30 secs ... 41 hrs 59 mins 30 secs | 1 day |\n| 41 hrs 59 mins 30 secs ... 29 days 23 hrs 59 mins 30 secs | [2..30] days |\n| 29 days 23 hrs 59 mins 30 secs ... 44 days 23 hrs 59 mins 30 secs | about 1 month |\n| 44 days 23 hrs 59 mins 30 secs ... 59 days 23 hrs 59 mins 30 secs | about 2 months |\n| 59 days 23 hrs 59 mins 30 secs ... 1 yr | [2..12] months |\n| 1 yr ... 1 yr 3 months | about 1 year |\n| 1 yr 3 months ... 1 yr 9 month s | over 1 year |\n| 1 yr 9 months ... 2 yrs | almost 2 years |\n| N yrs ... N yrs 3 months | about N years |\n| N yrs 3 months ... N yrs 9 months | over N years |\n| N yrs 9 months ... N+1 yrs | almost N+1 years |\n\nWith `options.includeSeconds == true`:\n| Distance between dates | Result |\n|------------------------|----------------------|\n| 0 secs ... 5 secs | less than 5 seconds |\n| 5 secs ... 10 secs | less than 10 seconds |\n| 10 secs ... 20 secs | less than 20 seconds |\n| 20 secs ... 40 secs | half a minute |\n| 40 secs ... 60 secs | less than a minute |\n| 60 secs ... 90 secs | 1 minute |","params":[{"type":{"names":["Date","String","Number"]},"description":"the date to compare with","name":"dateToCompare"},{"type":{"names":["Date","String","Number"]},"description":"the other date","name":"date"},{"type":{"names":["Object"]},"optional":true,"description":"the object with options","name":"options"},{"type":{"names":["Boolean"]},"optional":true,"defaultvalue":false,"description":"distances less than a minute are more detailed","name":"options.includeSeconds"},{"type":{"names":["Boolean"]},"optional":true,"defaultvalue":false,"description":"result indicates if the second date is earlier or later than the first","name":"options.addSuffix"},{"type":{"names":["Object"]},"optional":true,"defaultvalue":"enLocale","description":"the locale object","name":"options.locale"}],"examples":["// What is the distance between 2 July 2014 and 1 January 2015?\nvar result = distanceInWords(\n new Date(2014, 6, 2),\n new Date(2015, 0, 1)\n)\n//=> '6 months'","// What is the distance between 1 January 2015 00:00:15\n// and 1 January 2015 00:00:00, including seconds?\nvar result = distanceInWords(\n new Date(2015, 0, 1, 0, 0, 15),\n new Date(2015, 0, 1, 0, 0, 0),\n {includeSeconds: true}\n)\n//=> 'less than 20 seconds'","// What is the distance from 1 January 2016\n// to 1 January 2015, with a suffix?\nvar result = distanceInWords(\n new Date(2016, 0, 1),\n new Date(2015, 0, 1),\n {addSuffix: true}\n)\n//=> 'about 1 year ago'","// What is the distance between 1 August 2016 and 1 January 2015 in Esperanto?\nvar eoLocale = require('date-fns/locale/eo')\nvar result = distanceInWords(\n new Date(2016, 7, 1),\n new Date(2015, 0, 1),\n {locale: eoLocale}\n)\n//=> 'pli ol 1 jaro'"],"returns":[{"type":{"names":["String"]},"description":"the distance in words"}],"category":"Common Helpers","meta":{"lineno":94,"filename":"index.js","path":"/Users/lesha/Work/date-fns/src/distance_in_words"},"summary":"Return the distance between the given dates in words.","order":0}},{"type":"jsdoc","urlId":"distanceInWordsStrict","category":"Common Helpers","title":"distanceInWordsStrict","description":"Return the distance between the given dates in words.","content":{"id":"distanceInWordsStrict","longname":"distanceInWordsStrict","name":"distanceInWordsStrict","scope":"global","kind":"function","description":"Return the distance between the given dates in words, using strict units.\nThis is like `distanceInWords`, but does not use helpers like 'almost', 'over',\n'less than' and the like.\n\n| Distance between dates | Result |\n|------------------------|---------------------|\n| 0 ... 59 secs | [0..59] seconds |\n| 1 ... 59 mins | [1..59] minutes |\n| 1 ... 23 hrs | [1..23] hours |\n| 1 ... 29 days | [1..29] days |\n| 1 ... 11 months | [1..11] months |\n| 1 ... N years | [1..N] years |","params":[{"type":{"names":["Date","String","Number"]},"description":"the date to compare with","name":"dateToCompare"},{"type":{"names":["Date","String","Number"]},"description":"the other date","name":"date"},{"type":{"names":["Object"]},"optional":true,"description":"the object with options","name":"options"},{"type":{"names":["Boolean"]},"optional":true,"defaultvalue":false,"description":"result indicates if the second date is earlier or later than the first","name":"options.addSuffix"},{"type":{"names":["String"]},"optional":true,"description":"if specified, will force a unit. Options: 's', 'm', 'h', 'd', 'M', 'Y'","name":"options.unit"},{"type":{"names":["String"]},"optional":true,"defaultvalue":"'floor'","description":"which way to round partial units. Options: 'floor', 'ceil', 'round'","name":"options.partialMethod"},{"type":{"names":["Object"]},"optional":true,"defaultvalue":"enLocale","description":"the locale object","name":"options.locale"}],"examples":["// What is the distance between 2 July 2014 and 1 January 2015?\nvar result = distanceInWordsStrict(\n new Date(2014, 6, 2),\n new Date(2015, 0, 2)\n)\n//=> '6 months'","// What is the distance between 1 January 2015 00:00:15\n// and 1 January 2015 00:00:00?\nvar result = distanceInWordsStrict(\n new Date(2015, 0, 1, 0, 0, 15),\n new Date(2015, 0, 1, 0, 0, 0),\n)\n//=> '15 seconds'","// What is the distance from 1 January 2016\n// to 1 January 2015, with a suffix?\nvar result = distanceInWordsStrict(\n new Date(2016, 0, 1),\n new Date(2015, 0, 1),\n {addSuffix: true}\n)\n//=> '1 year ago'","// What is the distance from 1 January 2016\n// to 1 January 2015, in minutes?\nvar result = distanceInWordsStrict(\n new Date(2016, 0, 1),\n new Date(2015, 0, 1),\n {unit: 'm'}\n)\n//=> '525600 minutes'","// What is the distance from 1 January 2016\n// to 28 January 2015, in months, rounded up?\nvar result = distanceInWordsStrict(\n new Date(2015, 0, 28),\n new Date(2015, 0, 1),\n {unit: 'M', partialMethod: 'ceil'}\n)\n//=> '1 month'","// What is the distance between 1 August 2016 and 1 January 2015 in Esperanto?\nvar eoLocale = require('date-fns/locale/eo')\nvar result = distanceInWordsStrict(\n new Date(2016, 7, 1),\n new Date(2015, 0, 1),\n {locale: eoLocale}\n)\n//=> '1 jaro'"],"returns":[{"type":{"names":["String"]},"description":"the distance in words"}],"category":"Common Helpers","meta":{"lineno":94,"filename":"index.js","path":"/Users/lesha/Work/date-fns/src/distance_in_words_strict"},"summary":"Return the distance between the given dates in words.","order":0}},{"type":"jsdoc","urlId":"distanceInWordsToNow","category":"Common Helpers","title":"distanceInWordsToNow","description":"Return the distance between the given date and now in words.","content":{"id":"distanceInWordsToNow","longname":"distanceInWordsToNow","name":"distanceInWordsToNow","scope":"global","kind":"function","description":"Return the distance between the given date and now in words.\n\n| Distance to now | Result |\n|-------------------------------------------------------------------|---------------------|\n| 0 ... 30 secs | less than a minute |\n| 30 secs ... 1 min 30 secs | 1 minute |\n| 1 min 30 secs ... 44 mins 30 secs | [2..44] minutes |\n| 44 mins ... 30 secs ... 89 mins 30 secs | about 1 hour |\n| 89 mins 30 secs ... 23 hrs 59 mins 30 secs | about [2..24] hours |\n| 23 hrs 59 mins 30 secs ... 41 hrs 59 mins 30 secs | 1 day |\n| 41 hrs 59 mins 30 secs ... 29 days 23 hrs 59 mins 30 secs | [2..30] days |\n| 29 days 23 hrs 59 mins 30 secs ... 44 days 23 hrs 59 mins 30 secs | about 1 month |\n| 44 days 23 hrs 59 mins 30 secs ... 59 days 23 hrs 59 mins 30 secs | about 2 months |\n| 59 days 23 hrs 59 mins 30 secs ... 1 yr | [2..12] months |\n| 1 yr ... 1 yr 3 months | about 1 year |\n| 1 yr 3 months ... 1 yr 9 month s | over 1 year |\n| 1 yr 9 months ... 2 yrs | almost 2 years |\n| N yrs ... N yrs 3 months | about N years |\n| N yrs 3 months ... N yrs 9 months | over N years |\n| N yrs 9 months ... N+1 yrs | almost N+1 years |\n\nWith `options.includeSeconds == true`:\n| Distance to now | Result |\n|---------------------|----------------------|\n| 0 secs ... 5 secs | less than 5 seconds |\n| 5 secs ... 10 secs | less than 10 seconds |\n| 10 secs ... 20 secs | less than 20 seconds |\n| 20 secs ... 40 secs | half a minute |\n| 40 secs ... 60 secs | less than a minute |\n| 60 secs ... 90 secs | 1 minute |","params":[{"type":{"names":["Date","String","Number"]},"description":"the given date","name":"date"},{"type":{"names":["Object"]},"optional":true,"description":"the object with options","name":"options"},{"type":{"names":["Boolean"]},"optional":true,"defaultvalue":false,"description":"distances less than a minute are more detailed","name":"options.includeSeconds"},{"type":{"names":["Boolean"]},"optional"