[
  {
    "path": ".gitignore",
    "content": "node_modules\n.DS_Store\n\nnpm-debug.log*\nyarn-debug.log*\nyarn-error.log*\n\n.vscode\n\ncoverage\nyarn.lock\n\n.history"
  },
  {
    "path": ".prettierrc",
    "content": "{\n  \"singleQuote\": true,\n  \"trailingComma\": \"es5\"\n}\n"
  },
  {
    "path": ".travis.yml",
    "content": "language: node_js\nnode_js:\n  - 12\n  - 13\n  - 14\nafter_success:\n  - npm run coveralls\n"
  },
  {
    "path": "LICENSE",
    "content": "MIT License\n\nCopyright (c) 2018 You-Dont-Need\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n"
  },
  {
    "path": "README.md",
    "content": "# [You don't (may not) need Moment.js](https://you-dont-need.github.io/You-Dont-Need-Momentjs/#/)\n\n[![Join the community on Spectrum](https://withspectrum.github.io/badge/badge.svg)](https://dev.to/t/momentjs)\n\n[Moment.js](https://momentjs.com/) is a fantastic time & date library with lots of great features and utilities. However, if you are working on a performance sensitive web application, it might cause a huge performance overhead because of its complex APIs and large bundle size.\n\n![Large bundle size](./screenshot.png)\n\nProblems with Moment.js:\n\n- It is highly based on OOP APIs, which makes it fail to work with tree-shaking, thus leading to a huge bundle size and performance issues.\n- It is mutable and it causes bugs:\n  - [clone](https://momentjs.com/docs/#/parsing/moment-clone/)\n  - [How do I work around mutability in moment.js?](https://stackoverflow.com/questions/30979178/how-do-i-work-around-mutability-in-moment-js)\n- Complex OOP API (which doubles mutability problem). Here is an example:\n  https://github.com/moment/moment/blob/develop/src/test/moment/add_subtract.js#L244-L286\n  Moment.js allows to use `a.subtract('ms', 50)`, `a.subtract(50, 'ms')` and even `a.subtract('s', '50')`.\n\nIf you are not using timezone but only a few simple functions from moment.js, this might bloat your app, and therefore is considered overkill. [dayjs](https://github.com/iamkun/dayjs) has a smaller core and has very similar APIs so it makes it very easy to migrate. [date-fns](https://github.com/date-fns/date-fns) enables [tree-shaking and other benefits](https://github.com/date-fns/date-fns/issues/275#issuecomment-264934189) so that it works great with React, Sinon.js, and webpack, etc. See https://github.com/moment/moment/issues/2373 for more ideas on why and how people switch from moment.js to other solutions.\n\n## Brief Comparison\n\n| Name      | Tree-shaking | Methods richness | Pattern    | Locale | Timezone Support       | Popularity (stars)                                               | Sizes                                                                                                                        |\n| --------- | ------------ | ---------------- | ---------- | ------ | ---------------------- | ---------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------- |\n| Moment.js | No           | High             | OO         | 123    | Good (moment-timezone) | ![stars](https://flat.badgen.net/github/stars/moment/moment)     | ![raw](https://flat.badgen.net/bundlephobia/min/moment?label=min) ![size](https://flat.badgen.net/bundlephobia/minzip/moment?label=zip&color=purple)     |\n| Luxon     | No           | High             | OO         | -      | Good (Intl)            | ![stars](https://flat.badgen.net/github/stars/moment/luxon)      | ![raw](https://flat.badgen.net/bundlephobia/min/luxon?label=min) ![size](https://flat.badgen.net/bundlephobia/minzip/luxon?label=zip&color=purple)       |\n| date-fns  | Yes          | High             | Functional | 64     | Good (date-fns-tz)     | ![stars](https://flat.badgen.net/github/stars/date-fns/date-fns) | ![raw](https://flat.badgen.net/bundlephobia/min/date-fns?label=min) ![size](https://flat.badgen.net/bundlephobia/minzip/date-fns?label=zip&color=purple) |\n| dayjs     | No           | High             | OO         | 138    | Good (Intl)            | ![stars](https://flat.badgen.net/github/stars/iamkun/dayjs)      | ![raw](https://flat.badgen.net/bundlephobia/min/dayjs?label=min) ![size](https://flat.badgen.net/bundlephobia/minzip/dayjs?label=zip&color=purple)       |\n\n## Voice of Developers\n\n> [Removed moment.js to replace with date-fns - build output reduced by 40%](https://github.com/oysterprotocol/webnode/pull/116)\n\n> &mdash;<cite>Jared Farago from [webnode](https://github.com/oysterprotocol/webnode/pull/116) project.</cite>\n\n> [Good library if you’re looking to replace Moment.js for one reason or another. Immutable too.](https://twitter.com/dan_abramov/status/805030922785525760)\n\n> &mdash;<cite>Dan Abramov, Author of [Redux](https://github.com/reduxjs/redux) and co-author of [Create React App](https://github.com/facebook/create-react-app). Building tools for humans.</cite>\n\n> [I strongly recommend using date-fns over Moment.js, it's has a nicer API and you can include only parts you need!](https://twitter.com/silvenon/status/804946772690923520)\n\n> &mdash;<cite>Matija Marohnić, a design-savvy frontend developer from Croatia.</cite>\n\n## ESLint Plugin\n\n<p align=\"center\">\n  <a href=\"https://www.npmjs.com/package/eslint-plugin-you-dont-need-momentjs\">\n    <img src=\"https://img.shields.io/npm/v/eslint-plugin-you-dont-need-momentjs.svg?style=flat-square\"\n      alt=\"NPM Version\">\n  </a>\n  <a href=\"https://www.npmjs.org/package/eslint-plugin-you-dont-need-momentjs\">\n    <img src=\"http://img.shields.io/npm/dm/eslint-plugin-you-dont-need-momentjs.svg?style=flat-square?style=flat-square\"\n      alt=\"Downloads\">\n  </a>\n  <a href=\"https://travis-ci.org/you-dont-need/You-Dont-Need-Momentjs\">\n    <img src=\"https://img.shields.io/travis/you-dont-need/You-Dont-Need-Momentjs/master.svg?style=flat-square\"\n      alt=\"Build Status\">\n  </a>\n  <a href=\"https://coveralls.io/github/you-dont-need/You-Dont-Need-Momentjs?branch=master\">\n    <img src=\"https://img.shields.io/coveralls/you-dont-need/You-Dont-Need-Momentjs/master.svg?style=flat-square\"\n      alt=\"Coverage Status\" />\n  </a>\n</p>\n\nIf you're using [ESLint](http://eslint.org/), you can install a\n[plugin](http://eslint.org/docs/user-guide/configuring#using-the-configuration-from-a-plugin) that\nwill help you identify places in your codebase where you don't (may not) need Moment.js.\n\nInstall the plugin...\n\n```sh\nnpm install --save-dev eslint-plugin-you-dont-need-momentjs\n```\n\n...then update your config\n\n```js\n\"extends\" : [\"plugin:you-dont-need-momentjs/recommended\"],\n```\n\n## Quick Links\n\n**[Parse](#parse)**\n\n1. [String + Date Format](#string--date-format)\n1. [String + Time Format](#string--time-format)\n1. [String + Format + locale](#string--format--locale)\n\n**[Get + Set](#get--set)**\n\n1. [Millisecond/Second/Minute/Hour](#millisecond--second--minute--hour)\n1. [Date of Month](#date-of-month)\n1. [Day of Week](#day-of-week)\n1. [Day of Year](#day-of-year)\n1. [Week of Year](#week-of-year)\n1. [Days in Month](#days-in-month)\n1. [Weeks in Year](#weeks-in-year)\n1. [Maximum of the given dates](#maximum-of-the-given-dates)\n1. [Minimum of the given dates](#minimum-of-the-given-dates)\n\n**[Manipulate](#manipulate)**\n\n1. [Add](#add)\n1. [Subtract](#subtract)\n1. [Start of Time](#start-of-time)\n1. [End of Time](#end-of-time)\n\n**[Display](#display)**\n\n1. [Format](#format)\n1. [Time from now](#time-from-now)\n1. [Time from X](#time-from-x)\n1. [Difference](#difference)\n\n**[Query](#query)**\n\n1. [Is Before](#is-before)\n1. [Is Same](#is-same)\n1. [Is After](#is-after)\n1. [Is Between](#is-between)\n1. [Is Leap Year](#is-leap-year)\n1. [Is a Date](#is-a-date)\n\n# Feature Parity\n\n⚠️ Indicates other packages or work are needed. See individual functions [above](#quick-links).\n\n|                                | Native | Luxon | date-fns | dayjs | Temporal |\n| ------------------------------ | ------ | ----- | -------- | ----- | -------- |\n| **Parse**                      |        |       |          |       |          |\n| String + Date Format           | ✅     | ✅     | ✅       | ✅    | ✅         |\n| String + Time Format           | ✅     | ✅     | ✅       | ⚠️    | ✅        |\n| String + Format + locale       | ❌     | ⚠️     | ✅       | ⚠️    | ❌        |\n|                                |        |       |          |       |          |\n| **Get + Set**                  |        |       |          |       |          |\n| Millisecond/Second/Minute/Hour | ✅     | ✅    | ✅       | ✅    | ✅        |\n| Date of Month                  | ✅     | ✅    | ✅       | ✅    | ✅        |\n| Day of Week                    | ✅     | ✅    | ✅       | ✅    | ✅        |\n| Day of Year                    | ✅     | ✅    | ✅       | ✅    | ✅        |\n| Week of Year                   | ✅     | ✅    | ✅       | ⚠️    | ✅        |\n| Days in Month                  | ✅     | ✅    | ✅       | ✅    | ✅        |\n| Weeks in Year                  | ❌     | ❌    | ✅       | ⚠️    | ✅        |\n| Maximum of the given dates     | ✅     | ✅    | ✅       | ⚠️    | ✅        |\n| Minimum of the given dates     | ✅     | ✅    | ✅       | ⚠️    | ✅        |\n|                                |        |       |          |       |          |\n| **Manipulate**                 |        |       |          |       |          |\n| Add                            | ✅     | ✅    | ✅       | ✅    | ✅        |\n| Subtract                       | ✅     | ✅    | ✅       | ✅    | ✅        |\n| Start of Time                  | ❌     | ✅    | ✅       | ✅    | ✅        |\n| End of Time                    | ✅     | ✅    | ✅       | ✅    | ✅        |\n|                                |        |       |          |       |          |\n| **Display**                    |        |       |          |       |          |\n| Format                         | ✅     | ✅    | ✅       | ✅    | ✅        |\n| Time from now                  | ✅     | ❌    | ✅       | ⚠️    | ✅        |\n| Time from X                    | ❌     | ❌    | ✅       | ⚠️    | ✅        |\n| Difference                     | ✅     | ✅    | ✅       | ✅    | ✅        |\n|                                |        |       |          |       |          |\n| **Query**                      |        |       |          |       |          |\n| Is Before                      | ✅     | ✅    | ✅       | ✅    | ✅        |\n| Is Same                        | ✅     | ✅    | ✅       | ✅    | ✅        |\n| Is After                       | ✅     | ✅    | ✅       | ✅    | ✅        |\n| Is Between                     | ❌     | ✅    | ✅       | ⚠️    | ❌        |\n| Is Leap Year                   | ✅     | ✅    | ✅       | ⚠️    | ✅        |\n| Is a Date                      | ✅     | ✅    | ✅       | ✅    | ✅        |\n\n## Parse\n\n### String + Date Format\n\nReturn the date parsed from date string using the given format string.\n\n```js\n// Moment.js\nmoment('12-25-1995', 'MM-DD-YYYY');\n// => \"1995-12-24T13:00:00.000Z\"\n\n// Native\nconst datePattern = /^(\\d{2})-(\\d{2})-(\\d{4})$/;\nconst [, month, day, year] = datePattern.exec('12-25-1995');\nnew Date(`${month}, ${day} ${year}`);\n// => \"1995-12-24T13:00:00.000Z\"\n\n// date-fns\nimport parse from 'date-fns/parse';\nparse('12-25-1995', 'MM-dd-yyyy', new Date());\n// => \"1995-12-24T13:00:00.000Z\"\n\n// dayjs\ndayjs('12-25-1995');\n// => \"1995-12-24T13:00:00.000Z\"\n\n// luxon\nDateTime.fromFormat('12-25-1995', 'MM-dd-yyyy').toJSDate();\n// => \"1995-12-24T13:00:00.000Z\"\n\n// Temporal\nconst datePattern = /^(\\d{2})-(\\d{2})-(\\d{4})$/;\nconst [, month, day, year] = datePattern.exec('12-25-1995');\nnew Temporal.ZonedDateTime.from({year, month, day, timeZone: Temporal.Now.timeZone()});\n// => \"1995-12-24T13:00:00.000Z\"\n```\n\n**[⬆ back to top](#quick-links)**\n\n### String + Time Format\n\nReturn the date parsed from time string using the given format string.\n\n```js\n// Moment.js\nmoment('2010-10-20 4:30', 'YYYY-MM-DD HH:mm');\n// => \"2010-10-19T17:30:00.000Z\"\n\n// Native\nconst datePattern = /^(\\d{4})-(\\d{2})-(\\d{2})\\s(\\d{1,2}):(\\d{2})$/;\nconst [, year, month, day, rawHour, min] = datePattern.exec('2010-10-20 4:30');\nnew Date(`${year}-${month}-${day}T${('0' + rawHour).slice(-2)}:${min}:00`);\n// => \"2010-10-19T17:30:00.000Z\"\n\n// date-fns\nimport parse from 'date-fns/parse';\nparse('2010-10-20 4:30', 'yyyy-MM-dd H:mm', new Date());\n// => \"2010-10-19T17:30:00.000Z\"\n\n// dayjs ⚠️ requires customParseFormat plugin\nimport customParseFormat from 'dayjs/plugin/customParseFormat';\ndayjs.extend(customParseFormat);\ndayjs('2010-10-20 4:30', 'YYYY-MM-DD HH:mm');\n// => \"2010-10-19T17:30:00.000Z\"\n\n// luxon\nDateTime.fromFormat('2010-10-20 4:30', 'yyyy-MM-dd H:mm').toJSDate();\n// => \"2010-10-19T17:30:00.000Z\"\n\n// Temporal\nconst datePattern = /^(\\d{4})-(\\d{2})-(\\d{2})\\s(\\d{1,2}):(\\d{2})$/;\nconst [, year, month, day, hour, minute] = datePattern.exec('2010-10-20 4:30');\nnew Temporal.ZonedDateTime.from({year, month, day, hour, minute, timeZone: Temporal.Now.timeZone()});\n// => \"2010-10-19T17:30:00.000Z\"\n```\n\n**[⬆ back to top](#quick-links)**\n\n### String + Format + locale\n\nReturn the date parsed from string using the given format string and locale.\n\n```js\n// Moment.js\nmoment('2012 mars', 'YYYY MMM', 'fr');\n// => \"2012-02-29T13:00:00.000Z\"\n\n// date-fns\nimport parse from 'date-fns/parse';\nimport fr from 'date-fns/locale/fr';\nparse('2012 mars', 'yyyy MMMM', new Date(), { locale: fr });\n// => \"2012-02-29T13:00:00.000Z\"\n\n// dayjs ⚠️ requires customParseFormat plugin\nimport customParseFormat from 'dayjs/plugin/customParseFormat';\nimport 'dayjs/locale/fr';\ndayjs.extend(customParseFormat);\ndayjs('2012 mars', 'YYYY MMM', 'fr');\n// => \"2012-02-29T13:00:00.000Z\"\n\n// Luxon ❌ does not support Locale for node unless https://moment.github.io/luxon/docs/manual/install.html#node\nDateTime.fromFormat('2012 mars', 'yyyy MMMM', { locale: 'fr' });\n// => \"2012-02-29T13:00:00.000Z\"\n```\n\n**[⬆ back to top](#quick-links)**\n\n## Get + Set\n\n### Millisecond / Second / Minute / Hour\n\nGet the `Millisecond/Second/Minute/Hour` of the given date.\n\n```js\n// Moment.js\nmoment().seconds();\n// => 49\nmoment().hours();\n// => 19\n\n// Native\nnew Date().getSeconds();\n// => 49\nnew Date().getHours();\n// => 19\n\n// date-fns\nimport getSeconds from 'date-fns/getSeconds';\nimport getHours from 'date-fns/getHours';\ngetSeconds(new Date());\n// => 49\ngetHours(new Date());\n// => 19\n\n// dayjs\ndayjs().second();\n// => 49\ndayjs().hour();\n// => 19\n\n// Luxon\nDateTime.local().second;\n// => 49\nDateTime.local().hour;\n// => 19\n\n// Temporal\nTemporal.Now.zonedDateTimeISO().second;\n// => 49\nTemporal.Now.zonedDateTimeISO().hour;\n// => 19\n```\n\n### Performance tests\n\n| Library  | Time       |\n| -------- | ---------- |\n| Moment   | 1500.703ms |\n| Native   | 348.411ms  |\n| DateFns  | 520.670ms  |\n| DayJs    | 494.234ms  |\n| Luxon    | 1208.368ms |\n| Temporal | -          |\n\nSet the `Millisecond/Second/Minute/Hour` of the given date.\n\n```js\n// Moment.js\nmoment().seconds(30);\n// => \"2018-09-09T09:12:30.695Z\"\nmoment().hours(13);\n// => \"2018-09-09T03:12:49.695Z\"\n\n// Native\nnew Date(new Date().setSeconds(30));\n// => \"2018-09-09T09:12:30.695Z\"\nnew Date(new Date().setHours(13));\n// => \"2018-09-09T03:12:49.695Z\"\n\n// date-fns\nimport setSeconds from 'date-fns/setSeconds';\nimport setHours from 'date-fns/setHours';\nsetSeconds(new Date(), 30);\n// => \"2018-09-09T09:12:30.695Z\"\nsetHours(new Date(), 13);\n// => \"2018-09-09T03:12:49.695Z\"\n\n// dayjs\ndayjs().set('second', 30);\n// => \"2018-09-09T09:12:30.695Z\"\ndayjs().set('hour', 13);\n// => \"2018-09-09T03:12:49.695Z\"\n\n// luxon\nDateTime.utc()\n  .set({ second: 30 })\n  .toJSDate();\n// => \"2018-09-09T09:12:30.695Z\"\nDateTime.utc()\n  .set({ hour: 13 })\n  .toJSDate();\n// => \"2018-09-09T03:12:49.695Z\"\n\n// Temporal\nTemporal.Now.zonedDateTimeISO().with({ second: 30 });\n// => \"2018-09-09T09:12:30.695Z\"\nTemporal.Now.zonedDateTimeISO().with({ hour: 13 });\n// => \"2018-09-09T03:12:49.695Z\"\n```\n\n### Performance tests\n\n| Library  | Time       |\n| -------- | ---------- |\n| Moment   | 1689.744ms |\n| Native   | 636.741ms  |\n| DateFns  | 714.148ms  |\n| DayJs    | 2037.603ms |\n| Luxon    | 2897.571ms |\n| Temporal | -          |\n\n**[⬆ back to top](#quick-links)**\n\n### Date of Month\n\nGets or sets the day of the month.\n\n```js\n// Moment.js\nmoment().date();\n// => 9\nmoment().date(4);\n// => \"2018-09-04T09:12:49.695Z\"\n\n// Native\nnew Date().getDate();\n// => 9\nnew Date().setDate(4);\n// => \"2018-09-04T09:12:49.695Z\"\n\n// date-fns\nimport getDate from 'date-fns/getDate';\nimport setDate from 'date-fns/setDate';\ngetDate(new Date());\n// => 9\nsetDate(new Date(), 4);\n// => \"2018-09-04T09:12:49.695Z\"\n\n// dayjs\ndayjs().date();\n// => 9\ndayjs().set('date', 4);\n// => \"2018-09-04T09:12:49.695Z\"\n\n// luxon\nDateTime.utc().day;\n// => 9\nDateTime.utc()\n  .set({ day: 4 })\n  .toString();\n// => \"2018-09-04T09:12:49.695Z\"\n\n// Temporal\nTemporal.Now.zonedDateTimeISO().day;\n// => 9\nTemporal.Now.zonedDateTimeISO().with({ day: 4 });\n// => \"2018-09-04T09:12:49.695Z\"\n```\n\n### Performance tests\n\n| Library  | Time       |\n| -------- | ---------- |\n| Moment   | 1381.669ms |\n| Native   | 397.415ms  |\n| DateFns  | 588.004ms  |\n| DayJs    | 1218.025ms |\n| Luxon    | 2705.606ms |\n| Temporal | -          |\n\n**[⬆ back to top](#quick-links)**\n\n### Day of Week\n\nGets or sets the day of the week.\n\n```js\n// Moment.js\nmoment().day();\n// => 0 (Sunday)\nmoment().day(-14);\n// => \"2018-08-26T09:12:49.695Z\"\n\n// Native\nnew Date().getDay();\n// => 0 (Sunday)\nnew Date().setDate(new Date().getDate() - 14);\n// => \"2018-08-26T09:12:49.695Z\"\n\n// date-fns\nimport getDay from 'date-fns/getDay';\nimport setDay from 'date-fns/setDay';\ngetDay(new Date());\n// => 0 (Sunday)\nsetDay(new Date(), -14);\n// => \"2018-08-26T09:12:49.695Z\"\n\n// dayjs\ndayjs().day();\n// => 0 (Sunday)\ndayjs().set('day', -14);\n// => \"2018-08-26T09:12:49.695Z\"\n\n// Luxon\nDateTime.local().weekday;\n// => 7 (Sunday)\nDateTime.local()\n  .minus({ day: 14 })\n  .toJSDate();\n// => \"2018-08-26T09:12:49.695Z\"\n\n// Temporal\nTemporal.Now.zonedDateTimeISO().dayOfWeek;\n// => 7 (Sunday)\nTemporal.Now.zonedDateTimeISO().subtract(Temporal.Duration.from({ days: 14 }));\n// => \"2018-09-04T09:12:49.695Z\"\n```\n\n| Library  | Time       |\n| -------- | ---------- |\n| Moment   | 1919.404ms |\n| Native   | 543.466ms  |\n| DateFns  | 841.436ms  |\n| DayJs    | 1229.475ms |\n| Luxon    | 3936.282ms |\n| Temporal | -          |\n\n**[⬆ back to top](#quick-links)**\n\n### Day of Year\n\nGets or sets the day of the year.\n\n```js\n// Moment.js\nmoment().dayOfYear();\n// => 252\nmoment().dayOfYear(256);\n// => \"2018-09-13T09:12:49.695Z\"\n\n// Native\nMath.floor(\n  (new Date() - new Date(new Date().getFullYear(), 0, 0)) / 1000 / 60 / 60 / 24\n);\n// => 252\n\n// date-fns\nimport getDayOfYear from 'date-fns/getDayOfYear';\nimport setDayOfYear from 'date-fns/setDayOfYear';\ngetDayOfYear(new Date());\n// => 252\nsetDayOfYear(new Date(), 256);\n// => \"2018-09-13T09:12:49.695Z\"\n\n// dayjs ⚠️ requires dayOfYear plugin\nimport dayOfYear from 'dayjs/plugin/dayOfYear';\ndayjs.extend(dayOfYear);\ndayjs().dayOfYear();\n// => 252\ndayjs().dayOfYear(256);\n// => \"2018-09-13T09:12:49.695Z\"\n\n// Luxon\nDateTime.local().ordinal;\n// => 252\nDateTime.local()\n  .set({ ordinal: 256 })\n  .toString();\n// => \"2018-09-13T09:12:49.695Z\"\n\n// Temporal\nTemporal.Now.zonedDateTimeISO().dayOfYear;\n// => 252\nTemporal.Now.zonedDateTimeISO().with({month: 1, day: 1}).add(Temporal.Duration.from({days: 256}));\n// => \"2018-09-04T09:12:49.695Z\"\n```\n\n| Library  | Time       |\n| -------- | ---------- |\n| Moment   | 5511.172ms |\n| Native   | 530.592ms  |\n| DateFns  | 2079.043ms |\n| DayJs    | -          |\n| Luxon    | 3540.810ms |\n| Temporal | -          |\n\n**[⬆ back to top](#quick-links)**\n\n### Week of Year\n\nGets or sets the week of the year.\n\n```js\n// Moment.js\nmoment().week();\n// => 37\nmoment().week(24);\n// => \"2018-06-10T09:12:49.695Z\"\n\n// date-fns\nimport getWeek from 'date-fns/getWeek';\nimport setWeek from 'date-fns/setWeek';\ngetWeek(new Date());\n// => 37\nsetWeek(new Date(), 24);\n// => \"2018-06-10T09:12:49.695Z\"\n\n// native getWeek\nconst day = new Date();\nconst MILLISECONDS_IN_WEEK = 604800000;\nconst firstDayOfWeek = 1; // monday as the first day (0 = sunday)\nconst startOfYear = new Date(day.getFullYear(), 0, 1);\nstartOfYear.setDate(\n  startOfYear.getDate() + (firstDayOfWeek - (startOfYear.getDay() % 7))\n);\nconst dayWeek = Math.round((day - startOfYear) / MILLISECONDS_IN_WEEK) + 1;\n// => 37\n\n// native setWeek\nconst day = new Date();\nconst week = 24;\nconst MILLISECONDS_IN_WEEK = 604800000;\nconst firstDayOfWeek = 1; // monday as the first day (0 = sunday)\nconst startOfYear = new Date(day.getFullYear(), 0, 1);\nstartOfYear.setDate(\n  startOfYear.getDate() + (firstDayOfWeek - (startOfYear.getDay() % 7))\n);\nconst dayWeek = Math.round((day - startOfYear) / MILLISECONDS_IN_WEEK) + 1;\nday.setDate(day.getDate() - (dayWeek - week) * 7);\nday.toISOString();\n// => \"2018-06-10T09:12:49.794Z\n\n// dayjs ⚠️ requires weekOfYear plugin\nimport weekOfYear from 'dayjs/plugin/weekOfYear';\ndayjs.extend(weekOfYear);\ndayjs().week();\n// => 37\ndayjs().week(24);\n// => \"2018-06-10T09:12:49.695Z\"\n\n// Luxon\nDateTime.local().weekNumber;\n// => 37\nDateTime.local()\n  .set({ weekNumber: 23 })\n  .toString();\n// => \"2018-06-10T09:12:49.794Z\n\n// Temporal\nTemporal.Now.zonedDateTimeISO().weekOfYear;\n// => 252\nTemporal.Now.zonedDateTimeISO().with({month: 1, day: 1}).add(Temporal.Duration.from({weeks: 23}));\n// => \"2018-09-04T09:12:49.695Z\"\n```\n\n| Library  | Time       |\n| -------- | ---------- |\n| Moment   | 7147.201ms |\n| Native   | 1371.631ms |\n| DateFns  | 5834.815ms |\n| DayJs    | -          |\n| Luxon    | 4514.771ms |\n| Temporal | -          |\n\n**[⬆ back to top](#quick-links)**\n\n### Days in Month\n\nGet the number of days in the current month.\n\n```js\n// Moment.js\nmoment('2012-02', 'YYYY-MM').daysInMonth();\n// => 29\n\n// Native\nnew Date(2012, 02, 0).getDate();\n// => 29\n\n// date-fns\nimport getDaysInMonth from 'date-fns/getDaysInMonth';\ngetDaysInMonth(new Date(2012, 1));\n// => 29\n\n// dayjs\ndayjs('2012-02').daysInMonth();\n// => 29\n\n// Luxon\nDateTime.local(2012, 2).daysInMonth;\n// => 29\n\n// Temporal\n(new Temporal.PlainYearMonth(2012, 2)).daysInMonth\n// or\nTemporal.PlainYearMonth.from('2012-02').daysInMonth\n// => 29\n```\n\n| Library  | Time       |\n| -------- | ---------- |\n| Moment   | 4415.065ms |\n| Native   | 186.196ms  |\n| DateFns  | 634.084ms  |\n| DayJs    | 1922.774ms |\n| Luxon    | 1403.032ms |\n| Temporal | -          |\n\n**[⬆ back to top](#quick-links)**\n\n### Weeks in Year\n\nGets the number of weeks in the current year, according to ISO weeks.\n\n```js\n// Moment.js\nmoment().isoWeeksInYear();\n// => 52\n\n// Native\nconst year = new Date().getFullYear();\nconst MILLISECONDS_IN_WEEK = 604800000;\nconst firstMondayThisYear = new Date(+year,   0, 5-(new Date(+year,   0, 4).getDay()||7));\nconst firstMondayNextYear = new Date(+year+1, 0, 5-(new Date(+year+1, 0, 4).getDay()||7));\n(firstMondayNextYear - firstMondayThisYear) / MILLISECONDS_IN_WEEK;\n// => 52\n\n// date-fns\nimport getISOWeeksInYear from 'date-fns/getISOWeeksInYear';\ngetISOWeeksInYear(new Date());\n// => 52\n\n// dayjs ⚠️ requires isoWeeksInYear plugin\nimport isoWeeksInYear from 'dayjs/plugin/isoWeeksInYear';\ndayjs.extend(isoWeeksInYear);\ndayjs().isoWeeksInYear();\n// => 52\n\n// Luxon\nDateTime.local().weeksInWeekYear;\n// => 52\n\n// Temporal\nTemporal.PlainDate.from({day:31, month:12, year: Temporal.Now.plainDateISO()}).weekOfYear\n// => 52\n```\n\n| Library  | Time       |\n| -------- | ---------- |\n| Moment   | 1065.247ms |\n| Native   | -          |\n| DateFns  | 4954.042ms |\n| DayJs    | -          |\n| Luxon    | 1134.483ms |\n| Temporal | -          |\n\n**[⬆ back to top](#quick-links)**\n\n### Maximum of the given dates\n\nReturns the maximum (most distant future) of the given date.\n\n```js\nconst array = [\n  new Date(2017, 4, 13),\n  new Date(2018, 2, 12),\n  new Date(2016, 0, 10),\n  new Date(2016, 0, 9),\n];\n// Moment.js\nmoment.max(array.map(a => moment(a)));\n// => \"2018-03-11T13:00:00.000Z\"\n\n// Native\nnew Date(Math.max.apply(null, array)).toISOString();\n// => \"2018-03-11T13:00:00.000Z\"\n\n// date-fns\nimport max from 'date-fns/max';\nmax(array);\n// => \"2018-03-11T13:00:00.000Z\"\n\n// dayjs ⚠️ requires minMax plugin\nimport minMax from 'dayjs/plugin/minMax';\ndayjs.extend(minMax);\ndayjs.max(array.map(a => dayjs(a)));\n// => \"2018-03-11T13:00:00.000Z\"\n\n// Luxon\nDateTime.max(...array.map(a => DateTime.fromJSDate(a))).toJSDate();\n// => \"2018-03-11T13:00:00.000Z\"\n\n// Temporal\nTemporal.Instant.fromEpochMilliseconds(Math.max.apply(null, array))\n// => \"2018-03-11T13:00:00.000Z\"\n```\n\n| Library  | Time       |\n| -------- | ---------- |\n| Moment   | 1780.075ms |\n| Native   | 828.332ms  |\n| DateFns  | 980.938ms  |\n| DayJs    | -          |\n| Luxon    | 2694.702ms |\n| Temporal | -          |\n\n**[⬆ back to top](#quick-links)**\n\n### Minimum of the given dates\n\nReturns the minimum (most distant future) of the given date.\n\n```js\nconst array = [\n  new Date(2017, 4, 13),\n  new Date(2018, 2, 12),\n  new Date(2016, 0, 10),\n  new Date(2016, 0, 9),\n];\n// Moment.js\nmoment.min(array.map(a => moment(a)));\n// => \"2016-01-08T13:00:00.000Z\"\n\n// Native\nnew Date(Math.min.apply(null, array)).toISOString();\n// => \"2016-01-08T13:00:00.000Z\"\n\n// date-fns\nimport min from 'date-fns/min';\nmin(array);\n// => \"2016-01-08T13:00:00.000Z\"\n\n// dayjs ⚠️ requires minMax plugin\nimport minMax from 'dayjs/plugin/minMax';\ndayjs.extend(minMax);\ndayjs.min(array.map(a => dayjs(a)));\n// => \"2016-01-08T13:00:00.000Z\"\n\n// Luxon\nDateTime.min(...array.map(a => DateTime.fromJSDate(a))).toJSDate();\n// => \"2016-01-08T13:00:00.000Z\"\n\n// Temporal\nTemporal.Instant.fromEpochMilliseconds(Math.min.apply(null, array))\n// => \"2018-03-11T13:00:00.000Z\"\n```\n\n| Library  | Time       |\n| -------- | ---------- |\n| Moment   | 1744.459ms |\n| Native   | 819.646ms  |\n| DateFns  | 841.249ms  |\n| DayJs    | -          |\n| Luxon    | 2720.462ms |\n| Temporal | -          |\n\n**[⬆ back to top](#quick-links)**\n\n## Manipulate\n\n### Add\n\nAdd the specified number of days to the given date.\n\n```js\n// Moment.js\nmoment().add(7, 'days');\n// => \"2018-09-16T09:12:49.695Z\"\n\n// Native\nconst now = new Date();\nnow.setDate(now.getDate() + 7);\n// => \"Sun Sep 16 2018 09:12:49\"\n\n// date-fns\nimport addDays from 'date-fns/addDays';\naddDays(new Date(), 7);\n// => \"2018-09-16T09:12:49.695Z\"\n\n// dayjs\ndayjs().add(7, 'day');\n// => \"2018-09-16T09:12:49.695Z\"\n\n// Luxon\nDateTime.local()\n  .plus({ day: 7 })\n  .toJSDate();\n// => \"2018-09-16T09:12:49.695Z\"\n\n// Temporal\nTemporal.Now.zonedDateTimeISO().add(Temporal.Duration.from({days: 7}));\n// => \"2018-09-16T09:12:49.695Z\"\n```\n\n| Library  | Time       |\n| -------- | ---------- |\n| Moment   | 1309.485ms |\n| Native   | 259.932ms  |\n| DateFns  | 385.394ms  |\n| DayJs    | 1911.881ms |\n| Luxon    | 3919.797ms |\n| Temporal | -          |\n\n**[⬆ back to top](#quick-links)**\n\n### Subtract\n\nSubtract the specified number of days from the given date.\n\n```js\n// Moment.js\nmoment().subtract(7, 'days');\n// => \"2018-09-02T09:12:49.695Z\"\n\n// Native\nconst now = new Date();\nnow.setDate(now.getDate() - 7);\n// => Sun Sep 09 2018 09:12:49\n\n// date-fns\nimport subDays from 'date-fns/subDays';\nsubDays(new Date(), 7);\n// => \"2018-09-02T09:12:49.695Z\"\n\n// dayjs\ndayjs().subtract(7, 'day');\n// => \"2018-09-02T09:12:49.695Z\"\n\n// Luxon\nDateTime.local()\n  .minus({ day: 7 })\n  .toJSDate();\n// => \"2018-09-02T09:12:49.695Z\"\n\n// Temporal\nTemporal.Now.zonedDateTimeISO().subtract(Temporal.Duration.from({days: 7}));\n// => \"2018-09-02T09:12:49.695Z\"\n```\n\n| Library  | Time       |\n| -------- | ---------- |\n| Moment   | 1278.384ms |\n| Native   | 215.255ms  |\n| DateFns  | 379.057ms  |\n| DayJs    | 1772.593ms |\n| Luxon    | 4028.866ms |\n| Temporal | -          |\n\n**[⬆ back to top](#quick-links)**\n\n### Start of Time\n\nReturn the start of a unit of time for the given date.\n\n```js\n// Moment.js\nmoment().startOf('month');\n// => \"2018-08-31T14:00:00.000Z\"\n\n// date-fns\nimport startOfMonth from 'date-fns/startOfMonth';\nstartOfMonth(new Date());\n// => \"2018-08-31T14:00:00.000Z\"\n\n// dayjs\ndayjs().startOf('month');\n// => \"2018-08-31T14:00:00.000Z\"\n\n// Luxon\nDateTime.local().startOf('month');\n// => \"2018-09-02T09:12:49.695Z\"\n\n// Temporal\nTemporal.Now.zonedDateTimeISO().with({day: 1});\n// => \"2018-09-01T14:00:00.000Z\"\n```\n\n| Library  | Time       |\n| -------- | ---------- |\n| Moment   | 1078.948ms |\n| Native   | -          |\n| DateFns  | 398.107ms  |\n| DayJs    | 765.358ms  |\n| Luxon    | 2306.765ms |\n| Temporal | -          |\n\n**[⬆ back to top](#quick-links)**\n\n### End of Time\n\nReturn the end of a unit of time for the given date.\n\n```js\n// Moment.js\nmoment().endOf('day');\n// => \"2018-09-09T13:59:59.999Z\"\n\n// Native\nconst end = new Date();\nend.setHours(23, 59, 59, 999);\nend.toISOString();\n// => \"2018-09-09T16:59:59.999Z\"\n\n// date-fns\nimport endOfDay from 'date-fns/endOfDay';\nendOfDay(new Date());\n// => \"2018-09-09T13:59:59.999Z\"\n\n// dayjs\ndayjs().endOf('day');\n// => \"2018-09-09T13:59:59.999Z\"\n\n// Luxon\nDateTime.local().endOf('day');\n// => \"2018-09-02T09:12:49.695Z\"\n\n// Temporal\nTemporal.Now.zonedDateTimeISO().withPlainTime(new Temporal.PlainTime(23,59,59,999,999,999));\n// => \"2018-09-09T16:59:59.999999999Z\"\n```\n\n| Library  | Time       |\n| -------- | ---------- |\n| Moment   | 1241.304ms |\n| Native   | 225.519ms  |\n| DateFns  | 319.773ms  |\n| DayJs    | 914.425ms  |\n| Luxon    | 9920.529ms |\n| Temporal | -          |\n\n**[⬆ back to top](#quick-links)**\n\n## Display\n\n### Format\n\nReturn the formatted date string in the given format.\n\n```js\n// Moment.js\nmoment().format('dddd, MMMM Do YYYY, h:mm:ss A');\n// => \"Sunday, September 9th 2018, 7:12:49 PM\"\nmoment().format('ddd, hA');\n// => \"Sun, 7PM\"\n\n// Native\nnew Intl.DateTimeFormat('en-US', { dateStyle: 'full', timeStyle: 'medium' }).format(new Date())\n// => \"Sunday, September 9, 2018 at 7:12:49 PM\"\nnew Intl.DateTimeFormat('en-US', { weekday: 'short', hour: 'numeric' }).format(new Date())\n// => \"Sun, 7 PM\"\n\n// date-fns\nimport { intlFormat } from 'date-fns'\nintlFormat(new Date(), { dateStyle: 'full', timeStyle: 'medium' }, { locale: 'en-US', })\n// => \"Sunday, September 9, 2018 at 7:12:49 PM\"\nintlFormat(new Date(), { weekday: 'short', hour: 'numeric' }, { locale: 'en-US', })\n// => \"Sun, 7 PM\"\n\n// dayjs\ndayjs().format('dddd, MMMM D YYYY, h:mm:ss A');\n// => \"Sunday, September 9 2018, 7:12:49 PM\"\ndayjs().format('ddd, hA');\n// => \"Sun, 7PM\"\n// dayjs ⚠️ requires advancedFormat plugin to support more format tokens\nimport advancedFormat from 'dayjs/plugin/advancedFormat';\ndayjs.extend(advancedFormat);\ndayjs().format('dddd, MMMM Do YYYY, h:mm:ss A');\n// => \"Sunday, September 9th 2018, 7:12:49 PM\"\n\n// Luxon\nDateTime.fromMillis(time).toFormat('EEEE, MMMM dd yyyy, h:mm:ss a');\n// => \"Sunday, September 9 2018, 7:12:49 PM\" ⚠️  not support 9th\nDateTime.fromMillis(time).toFormat('EEE, ha');\n// => \"Sun, 7PM\"\n\n// Temporal\nnew Intl.DateTimeFormat('en-US', { dateStyle: 'full', timeStyle: 'medium' }).format(Temporal.Now.zonedDateTimeISO())\n// => \"Sunday, September 9, 2018 at 7:12:49 PM\"\nnew Intl.DateTimeFormat('en-US', { weekday: 'short', hour: 'numeric' }).format(Temporal.Now.zonedDateTimeISO())\n// => \"Sun, 7 PM\"\n```\n\n**[⬆ back to top](#quick-links)**\n\n### Time from now\n\nReturn time from now.\n\n```js\n// Moment.js\nmoment(1536484369695).fromNow();\n// => \"4 days ago\"\n\n// Native\nnew Intl.RelativeTimeFormat().format(-4, 'day');\n// => \"4 days ago\"\n\n// date-fns\nimport formatDistance from 'date-fns/formatDistance';\nformatDistance(new Date(1536484369695), new Date(), { addSuffix: true });\n// => \"4 days ago\"\n\n// dayjs ⚠️ requires relativeTime plugin\nimport relativeTime from 'dayjs/plugin/relativeTime';\ndayjs.extend(relativeTime);\n\ndayjs(1536484369695).fromNow();\n// => \"5 days ago\" ⚠️  the rounding method of this plugin is different from moment.js and date-fns, use with care.\n\n// luxon requires Intl.RelativeTimeFormat\nDateTime.local(2022, 1, 27).toRelative({ base: this })\n// => \"in 4 months\"\n\n// Temporal\nnew Intl.RelativeTimeFormat().format(-4, 'day');\n// => \"4 days ago\"\n```\n\n**[⬆ back to top](#quick-links)**\n\n### Time from x\n\nReturn time from x.\n\n```js\n// Moment.js\nmoment([2007, 0, 27]).to(moment([2007, 0, 29]));\n// => \"in 2 days\"\n\n// date-fns\nimport formatDistance from 'date-fns/formatDistance';\nformatDistance(new Date(2007, 0, 27), new Date(2007, 0, 29));\n// => \"2 days\"\n\n// dayjs ⚠️ requires relativeTime plugin\nimport relativeTime from 'dayjs/plugin/relativeTime';\ndayjs.extend(relativeTime);\ndayjs('2007-01-27').to(dayjs('2007-01-29'));\n// => \"in 2 days\"\n\n// luxon ❌ does not support relative time\n\n// Temporal\nTemporal.PlainDate.from('2007-01-27').until('2007-01-29');\n// => Temporal.Duration('P2D')\n```\n\n**[⬆ back to top](#quick-links)**\n\n### Difference\n\nGet the unit of time between the given dates.\n\n```js\n// Moment.js\nmoment([2007, 0, 27]).diff(moment([2007, 0, 29]));\n// => -172800000\nmoment([2007, 0, 27]).diff(moment([2007, 0, 29]), 'days');\n// => -2\n\n// Native\nnew Date(2007, 0, 27) - new Date(2007, 0, 29);\n// => -172800000\nMath.ceil(\n  (new Date(2007, 0, 27) - new Date(2007, 0, 29)) / 1000 / 60 / 60 / 24\n);\n// => -2\n\n// date-fns\nimport differenceInMilliseconds from 'date-fns/differenceInMilliseconds';\ndifferenceInMilliseconds(new Date(2007, 0, 27), new Date(2007, 0, 29));\n// => -172800000\nimport differenceInDays from 'date-fns/differenceInDays';\ndifferenceInDays(new Date(2007, 0, 27), new Date(2007, 0, 29));\n// => -2\n\n// dayjs\ndayjs('2007-01-27').diff(dayjs('2007-01-29'), 'milliseconds');\n// => -172800000\ndayjs('2007-01-27').diff(dayjs('2007-01-29'), 'days');\n// => -2\n\n// luxon\nDateTime.local(2007, 1, 27).diff(DateTime.local(2007, 1, 29)).milliseconds;\n// => -172800000\nDateTime.local(2007, 1, 27).diff(DateTime.local(2007, 1, 29), 'days').days;\n// => -2\n\n// Temporal\nTemporal.PlainDate.from('2007-01-27').since('2007-01-29').total({unit: 'millisecond'});\n// => -172800000\nTemporal.PlainDate.from('2007-01-27').since('2007-01-29').total({unit: 'day'});\n// => -2\n```\n\n**[⬆ back to top](#quick-links)**\n\n## Query\n\n### Is Before\n\nCheck if a date is before another date.\n\n```js\n// Moment.js\nmoment('2010-10-20').isBefore('2010-10-21');\n// => true\n\n// Native\nnew Date(2010, 10, 20) < new Date(2010, 10, 21);\n// => true\n\n// date-fns\nimport isBefore from 'date-fns/isBefore';\nisBefore(new Date(2010, 9, 20), new Date(2010, 9, 21));\n// => true\n\n// dayjs\ndayjs('2010-10-20').isBefore('2010-10-21');\n// => true\n\n// luxon\nDateTime.fromISO('2010-10-20') < DateTime.fromISO('2010-10-21');\n// => true\n\n// Temporal\nTemporal.PlainDate.compare('2010-10-20', '2010-10-21') === -1;\n// => true\n```\n\n**[⬆ back to top](#quick-links)**\n\n### Is Same\n\nCheck if a date is the same as another date.\n\n```js\n// Moment.js\nmoment('2010-10-20').isSame('2010-10-21');\n// => false\nmoment('2010-10-20').isSame('2010-10-20');\n// => true\nmoment('2010-10-20').isSame('2010-10-21', 'month');\n// => true\n\n// Native\nnew Date(2010, 9, 20).valueOf() === new Date(2010, 9, 21).valueOf();\n// => false\nnew Date(2010, 9, 20).valueOf() === new Date(2010, 9, 20).valueOf();\n// => true\nnew Date(2010, 9, 20).getTime() === new Date(2010, 9, 20).getTime();\n// => true\nnew Date(2010, 9, 20).valueOf() === new Date(2010, 9, 20).getTime();\n// => true\nnew Date(2010, 9, 20).toDateString().substring(4, 7) ===\n  new Date(2010, 9, 21).toDateString().substring(4, 7);\n// => true\n\n// date-fns\nimport isSameDay from 'date-fns/isSameDay';\nimport isSameMonth from 'date-fns/isSameMonth';\nisSameDay(new Date(2010, 9, 20), new Date(2010, 9, 21));\n// => false\nisSameDay(new Date(2010, 9, 20), new Date(2010, 9, 20));\n// => true\nisSameMonth(new Date(2010, 9, 20), new Date(2010, 9, 21));\n// => true\n\n// dayjs\ndayjs('2010-10-20').isSame('2010-10-21');\n// => false\ndayjs('2010-10-20').isSame('2010-10-20');\n// => true\ndayjs('2010-10-20').isSame('2010-10-21', 'month');\n// => true\n\n// luxon\n(+DateTime.fromISO('2010-10-20') ===\n  +DateTime.fromISO('2010-10-21') +\n    // => false\n    DateTime.fromISO('2010-10-20')) ===\n  +DateTime.fromISO('2010-10-20');\n// => true\nDateTime.fromISO('2010-10-20').hasSame(DateTime.fromISO('2010-10-21'), 'month');\n// => true\n\n// Temporal\nTemporal.PlainDate.from('2010-10-20').equals('2010-10-21');\n// => false\nTemporal.PlainDate.from('2010-10-20').equals('2010-10-20');\n// => true\nTemporal.PlainDate.from('2010-10-20').month === Temporal.PlainDate.from('2010-10-21').month;\n// => true\n```\n\n**[⬆ back to top](#quick-links)**\n\n### Is After\n\nCheck if a date is after another date.\n\n```js\n// Moment.js\nmoment('2010-10-20').isAfter('2010-10-19');\n// => true\n\n// Native\nnew Date(2010, 9, 20) > new Date(2010, 9, 19);\n// => true\n\n// date-fns\nimport isAfter from 'date-fns/isAfter';\nisAfter(new Date(2010, 9, 20), new Date(2010, 9, 19));\n// => true\n\n// dayjs\ndayjs('2010-10-20').isAfter('2010-10-19');\n// => true\n\n// luxon\nDateTime.fromISO('2010-10-20') > DateTime.fromISO('2010-10-19');\n// => true\n\n// Temporal\nTemporal.PlainDate.compare('2010-10-20', '2010-10-19') === 1;\n// => true\n```\n\n**[⬆ back to top](#quick-links)**\n\n### Is Between\n\nCheck if a date is between two other dates.\n\n```js\n// Moment.js\nmoment('2010-10-20').isBetween('2010-10-19', '2010-10-25');\n// => true\n\n// date-fns\nimport isWithinInterval from 'date-fns/isWithinInterval';\nisWithinInterval(new Date(2010, 9, 20), {\n  start: new Date(2010, 9, 19),\n  end: new Date(2010, 9, 25),\n});\n// => true\n\n// dayjs ⚠️ requires isBetween plugin\nimport isBetween from 'dayjs/plugin/isBetween';\ndayjs.extend(isBetween);\ndayjs('2010-10-20').isBetween('2010-10-19', '2010-10-25');\n// => true\n\n// luxon\nInterval.fromDateTimes(\n  DateTime.fromISO('2010-10-19'),\n  DateTime.fromISO('2010-10-25')\n).contains(DateTime.fromISO('2010-10-20'));\n// => true\n```\n\n**[⬆ back to top](#quick-links)**\n\n### Is Leap Year\n\nCheck if a year is a leap year.\n\n```js\n// Moment.js\nmoment([2000]).isLeapYear();\n// => true\n\n// Native\nnew Date(2000, 1, 29).getDate() === 29;\n// => true\n\n// date-fns\nimport isLeapYear from 'date-fns/isLeapYear';\nisLeapYear(new Date(2000, 0, 1));\n// => true\n\n// dayjs ⚠️ requires isLeapYear plugin\nimport isLeapYear from 'dayjs/plugin/isLeapYear';\ndayjs.extend(isLeapYear);\ndayjs('2000-01-01').isLeapYear();\n// => true\n\n// luxon\nexpect(DateTime.local(2000).isInLeapYear).toBeTruthy();\n// => true\n\n// Temporal\nTemporal.PlainDate.from('2000-01-01').inLeapYear;\n// => true\n```\n\n**[⬆ back to top](#quick-links)**\n\n### Is a Date\n\nCheck if a variable is a native js Date object.\n\n```js\n// Moment.js\nmoment.isDate(new Date());\n// => true\n\n// Native\nnew Date() instanceof Date;\n// => true\n\n// date-fns\nimport isDate from 'date-fns/isDate';\nisDate(new Date());\n// => true\n\n// dayjs\ndayjs(new Date()).isValid();\n\n// luxon\nDateTime.local().isValid;\n// => true\n\n// Temporal\nnew Date() instanceof Date;\nTemporal.Now.plainTimeISO() instanceof Temporal.PlainTime;\nTemporal.Now.plainDateISO() instanceof Temporal.PlainDate;\nTemporal.Now.plainDateTimeISO() instanceof Temporal.PlainDateTime;\nTemporal.Now.zonedDateTimeISO() instanceof Temporal.ZonedDateTime;\n// => true\n```\n\n**[⬆ back to top](#quick-links)**\n\n# License\n\nMIT\n"
  },
  {
    "path": "__tests__/index.js",
    "content": "const moment = require('moment');\nconst { DateTime, Interval } = require('luxon');\nconst date = require('date-fns');\nconst fr = require('date-fns/locale/fr');\nconst dayjs = require('dayjs');\nconst relativeTime = require('dayjs/plugin/relativeTime'); // load on demand\nconst weekOfYear = require('dayjs/plugin/weekOfYear'); // load on demand\nconst isBetween = require('dayjs/plugin/isBetween'); // load on demand\nconst isLeapYear = require('dayjs/plugin/isLeapYear'); // load on demand\ndayjs.extend(relativeTime);\ndayjs.extend(weekOfYear);\ndayjs.extend(isBetween);\ndayjs.extend(isLeapYear);\n\nconst time = 1536484369695;\n\ndescribe('Parse', () => {\n  it('String + Date Format', () => {\n    const m = moment('12-25-1995', 'MM-DD-YYYY');\n\n    const [, mm, dd, yyyy] = /^(\\d{2})-(\\d{2})-(\\d{4})$/.exec('12-25-1995');\n    const n = new Date(`${mm}, ${dd} ${yyyy}`);\n    expect(m.valueOf()).toBe(n.getTime());\n\n    const d = date.parse('12-25-1995', 'MM-dd-yyyy', new Date());\n    expect(m.valueOf()).toBe(d.getTime());\n\n    const day = dayjs('12-25-1995');\n    expect(m.valueOf()).toBe(day.valueOf());\n\n    const luxon = DateTime.fromFormat('12-25-1995', 'MM-dd-yyyy');\n    expect(m.valueOf()).toBe(luxon.ts);\n  });\n  it('String + Time Format', () => {\n    const m = moment('2010-10-20 4:30', 'YYYY-MM-DD HH:mm');\n\n    const [\n      ,\n      yyyy,\n      mm,\n      dd,\n      hh,\n      mi,\n    ] = /^(\\d{4})-(\\d{2})-(\\d{2})\\s(\\d{1,2}):(\\d{2})$/.exec('2010-10-20 4:30');\n    const n = new Date(`${yyyy}-${mm}-${dd}T${('0' + hh).slice(-2)}:${mi}:00`);\n    expect(m.valueOf()).toBe(n.getTime());\n\n    const d = date.parse('2010-10-20 4:30', 'yyyy-MM-dd H:mm', new Date());\n    expect(m.valueOf()).toBe(d.getTime());\n\n    const luxon = DateTime.fromFormat('2010-10-20 4:30', 'yyyy-MM-dd H:mm');\n    expect(m.valueOf()).toBe(luxon.ts);\n  });\n  it('String + Format + locale', () => {\n    const m = moment('2012 mars', 'YYYY MMM', 'fr');\n\n    const d = date.parse('2012 mars', 'yyyy MMMM', new Date(), { locale: fr });\n    expect(m.valueOf()).toBe(d.getTime());\n  });\n});\n\ndescribe('Get + Set', () => {\n  it('get Second', () => {\n    const m = moment(time).seconds();\n\n    const n = new Date(time).getSeconds();\n    expect(m).toBe(n);\n\n    const d = date.getSeconds(new Date(time));\n    expect(m).toBe(d);\n\n    const day = dayjs(time).second();\n    expect(m).toBe(day);\n\n    const luxon = DateTime.fromMillis(time).second;\n    expect(m).toBe(luxon);\n  });\n  it('set Second', () => {\n    const m = moment(time)\n      .seconds(30)\n      .valueOf();\n    const n = new Date(time).setSeconds(30);\n    expect(m).toBe(n);\n\n    const d = date.setSeconds(new Date(time), 30).getTime();\n    expect(m).toBe(d);\n\n    const day = dayjs(time)\n      .set('second', 30)\n      .valueOf();\n    expect(m).toBe(day);\n\n    const luxon = DateTime.fromMillis(time).set({ second: 30 });\n    expect(m).toBe(luxon.ts);\n  });\n\n  it('get Hour', () => {\n    const m = moment(time).hours();\n    const n = new Date(time).getHours();\n    expect(m).toBe(n);\n\n    const d = date.getHours(new Date(time));\n    expect(m).toBe(d);\n\n    const day = dayjs(time).hour();\n    expect(m).toBe(day);\n\n    const luxon = DateTime.fromMillis(time).hour;\n    expect(m).toBe(luxon);\n  });\n  it('set Hour', () => {\n    const m = moment(time)\n      .hour(13)\n      .valueOf();\n    const n = new Date(time).setHours(13);\n    expect(m).toBe(n);\n\n    const d = date.setHours(new Date(time), 13).getTime();\n    expect(m).toBe(d);\n\n    const day = dayjs(time)\n      .set('hour', 13)\n      .valueOf();\n    expect(m).toBe(day);\n\n    const luxon = DateTime.fromMillis(time).set({ hour: 13 });\n    expect(m).toBe(luxon.ts);\n  });\n\n  it('get Date of Month', () => {\n    const m = moment(time).date();\n    const n = new Date(time).getDate();\n    expect(m).toBe(n);\n\n    const d = date.getDate(new Date(time));\n    expect(m).toBe(d);\n\n    const day = dayjs(time).date();\n    expect(m).toBe(day);\n\n    const luxon = DateTime.fromMillis(time).day;\n    expect(m).toBe(luxon);\n  });\n\n  it('set Date of Month', () => {\n    const m = moment(time)\n      .date(4)\n      .valueOf();\n    const n = new Date(time).setDate(4);\n    expect(m).toBe(n);\n\n    const d = date.setDate(new Date(time), 4).getTime();\n    expect(m).toBe(d);\n\n    const day = dayjs(time)\n      .set('date', 4)\n      .valueOf();\n    expect(m).toBe(day);\n\n    const luxon = DateTime.fromMillis(time).set({ day: 4 });\n    expect(m).toBe(luxon.ts);\n  });\n\n  it('get Day of Week', () => {\n    const m = moment(time).day();\n    const n = new Date(time).getDay();\n    expect(m).toBe(n);\n\n    const d = date.getDay(new Date(time));\n    expect(m).toBe(d);\n\n    const day = dayjs(time).day();\n    expect(m).toBe(day);\n\n    const luxon = DateTime.fromMillis(time).weekday;\n    expect(m).toBe(luxon % 7);\n  });\n\n  it('set Day of Week', () => {\n    const m = moment(time)\n      .day(-14)\n      .valueOf();\n    const n = new Date(time).setDate(new Date(time).getDate() - 14);\n    expect(m).toBe(n);\n\n    const d = date.setDay(new Date(time), -14).getTime();\n    expect(m).toBe(d);\n\n    const day = dayjs(time)\n      .set('day', -14)\n      .valueOf();\n    expect(m).toBe(day);\n\n    const luxon = DateTime.fromMillis(time).minus({ day: 14 });\n    expect(m).toBe(luxon.ts);\n  });\n\n  it('get Day of Year', () => {\n    const m = moment(time).dayOfYear();\n    const n = Math.floor(\n      (new Date(time) - new Date(new Date(time).getFullYear(), 0, 0)) /\n        1000 /\n        60 /\n        60 /\n        24\n    );\n    expect(m).toBe(n);\n\n    const d = date.getDayOfYear(new Date(time));\n    expect(m).toBe(d);\n\n    const luxon = DateTime.fromMillis(time).ordinal;\n    expect(m).toBe(luxon);\n  });\n\n  it('set Day of Year', () => {\n    const m = moment(time)\n      .dayOfYear(256)\n      .valueOf();\n    const d = date.setDayOfYear(new Date(time), 256).getTime();\n    expect(m).toBe(d);\n\n    const luxon = DateTime.fromMillis(time).set({ ordinal: 256 }).ts;\n    expect(m).toBe(luxon);\n  });\n\n  it('get Week of Year', () => {\n    const m = moment(time).week();\n\n    const MILLISECONDS_IN_WEEK = 604800000;\n    const firstDayOfWeek = 1; // monday as the first day (0 = sunday)\n    const t = new Date(time);\n    const s = new Date(t.getFullYear(), 0, 1);\n    s.setDate(s.getDate() + ((firstDayOfWeek - s.getDay()) % 7));\n    const n = Math.round((t - s) / MILLISECONDS_IN_WEEK) + 1;\n    expect(m).toBe(n);\n\n    const d = date.getWeek(new Date(time));\n    expect(m).toBe(d);\n\n    const day = dayjs(time).week(); // plugin\n    expect(m).toBe(day);\n\n    const luxon = DateTime.fromMillis(time).weekNumber + 1;\n    expect(m).toBe(luxon);\n  });\n\n  it('set Week of Year', () => {\n    const MILLISECONDS_IN_WEEK = 604800000;\n    const firstDayOfWeek = 1; // monday as the first day (0 = sunday)\n\n    const m = moment(time)\n      .week(24)\n      .valueOf();\n    const n = new Date(time);\n    const s = new Date(n.getFullYear(), 0, 1);\n    s.setDate(s.getDate() + ((firstDayOfWeek - s.getDay()) % 7));\n    const w = Math.round((n - s) / MILLISECONDS_IN_WEEK) + 1;\n    n.setDate(n.getDate() - (w - 24) * 7);\n    const d = date.setWeek(new Date(time), 24).getTime();\n    expect(m).toBe(d);\n    expect(m).toBe(n.getTime());\n    expect(n.getTime()).toBe(d);\n\n    const luxon = DateTime.fromMillis(time).set({ weekNumber: 23 });\n    expect(m).toBe(luxon.ts);\n  });\n\n  it('Days in Month', () => {\n    const m = moment('2012-02', 'YYYY-MM').daysInMonth();\n    const d = date.getDaysInMonth(new Date(2012, 1));\n    expect(m).toBe(d);\n\n    const day = dayjs('2012-02').daysInMonth();\n    expect(m).toBe(day);\n\n    const n = new Date(2012, 2, 0).getDate();\n    expect(m).toBe(n);\n\n    const luxon = DateTime.local(2012, 2).daysInMonth;\n    expect(m).toBe(luxon);\n  });\n\n  it('get Weeks In Year', () => {\n    const m = moment(time).isoWeeksInYear();\n    const d = date.getISOWeeksInYear(new Date(time));\n    expect(m).toBe(d);\n\n    const luxon = DateTime.fromMillis(time).weeksInWeekYear;\n    expect(m).toBe(luxon);\n  });\n\n  it('Maximum of the given dates', () => {\n    const array = [\n      new Date(2017, 4, 13),\n      new Date(2018, 2, 12),\n      new Date(2016, 0, 10),\n      new Date(2016, 0, 9),\n    ];\n    const m = moment.max(array.map(a => moment(a)));\n    const d = date.max(array);\n    expect(m.valueOf()).toBe(d.getTime());\n    expect(d).toEqual(new Date(2018, 2, 12));\n\n    const n = new Date(Math.max.apply(null, array));\n    expect(n).toEqual(new Date(2018, 2, 12));\n\n    const luxon = DateTime.max(\n      ...array.map(a => DateTime.fromJSDate(a))\n    ).toJSDate();\n    expect(luxon).toEqual(new Date(2018, 2, 12));\n  });\n\n  it('Minimum of the given dates', () => {\n    const array = [\n      new Date(2017, 4, 13),\n      new Date(2018, 2, 12),\n      new Date(2016, 0, 10),\n      new Date(2016, 0, 9),\n    ];\n    const n = new Date(Math.min.apply(null, array));\n    expect(n).toEqual(new Date(2016, 0, 9));\n\n    const m = moment.min(array.map(a => moment(a)));\n    const d = date.min(array);\n    expect(m.valueOf()).toBe(d.getTime());\n    expect(d).toEqual(new Date(2016, 0, 9));\n\n    const luxon = DateTime.min(\n      ...array.map(a => DateTime.fromJSDate(a))\n    ).toJSDate();\n    expect(luxon).toEqual(new Date(2016, 0, 9));\n  });\n});\n\ndescribe('Manipulate', () => {\n  it('Add', () => {\n    const m = moment(time).add(7, 'days');\n    const d = date.addDays(new Date(time), 7);\n    expect(m.valueOf()).toBe(d.getTime());\n\n    const n = new Date(time);\n    n.setDate(n.getDate() + 7);\n    expect(n.valueOf()).toBe(m.valueOf());\n\n    const day = dayjs(time).add(7, 'day');\n    expect(m.valueOf()).toBe(day.valueOf());\n\n    const luxon = DateTime.fromMillis(time).plus({ day: 7 });\n    expect(m.valueOf()).toBe(luxon.ts);\n  });\n\n  it('Subtract', () => {\n    const m = moment(time).subtract(7, 'days');\n    const n = new Date(new Date(time).getTime() - 1000 * 60 * 60 * 24 * 7);\n    expect(n.valueOf()).toBe(m.valueOf());\n\n    const d = date.subDays(new Date(time), 7);\n    expect(m.valueOf()).toBe(d.getTime());\n\n    const day = dayjs(time).subtract(7, 'day');\n    expect(m.valueOf()).toBe(day.valueOf());\n\n    const luxon = DateTime.fromMillis(time).minus({ day: 7 });\n    expect(m.valueOf()).toBe(luxon.ts);\n  });\n\n  it('Start of Time', () => {\n    const m = moment(time).startOf('month');\n    const d = date.startOfMonth(new Date(time));\n    expect(m.valueOf()).toBe(d.getTime());\n\n    const day = dayjs(time).startOf('month');\n    expect(m.valueOf()).toBe(day.valueOf());\n\n    const luxon = DateTime.fromMillis(time).startOf('month');\n    expect(m.valueOf()).toBe(luxon.ts);\n  });\n\n  it('End of Time', () => {\n    const m = moment(time).endOf('day');\n    const n = new Date(time).setHours(23, 59, 59, 999);\n    expect(m.valueOf()).toBe(n);\n\n    const d = date.endOfDay(new Date(time));\n    expect(m.valueOf()).toBe(d.getTime());\n\n    const day = dayjs(time).endOf('day');\n    expect(m.valueOf()).toBe(day.valueOf());\n\n    const luxon = DateTime.fromMillis(time).endOf('day');\n    expect(m.valueOf()).toBe(luxon.ts);\n  });\n});\n\ndescribe('Display', () => {\n  it('Format', () => {\n    const m = moment(time).format('dddd, MMMM D YYYY, h:mm:ss A');\n    const d = date.format(new Date(time), 'eeee, MMMM d yyyy, h:mm:ss aa', {\n      awareOfUnicodeTokens: true,\n    });\n    const day = dayjs(time).format('dddd, MMMM D YYYY, h:mm:ss A');\n    const l = DateTime.fromMillis(time).toFormat(\n      'EEEE, MMMM d yyyy, h:mm:ss a'\n    );\n    expect(m).toBe(d);\n    expect(m).toBe(day);\n    expect(m).toBe(l);\n\n    const m2 = moment(time).format('ddd, hA');\n    const d2 = date.format(new Date(time), 'eee, ha');\n    const day2 = dayjs(time).format('ddd, hA');\n    const l2 = DateTime.fromMillis(time).toFormat('EEE, ha');\n    expect(m2).toBe(d2);\n    expect(m2).toBe(day2);\n    expect(m2).toBe(l2);\n  });\n\n  it('Time from now', () => {\n    const month3 = 1000 * 3600 * 24 * 30 * 3; // ms * hour * day * month * 3\n    const timeDistance = new Date().getTime() - month3;\n\n    moment.relativeTimeThreshold(\n      'd',\n      new Date(new Date().getFullYear(), new Date().getMonth() + 1, 0).getDate()\n    );\n    const m = moment(timeDistance).fromNow();\n    const n = new Intl.RelativeTimeFormat().format(-3, 'month');\n    const d = date.formatDistanceStrict(new Date(timeDistance), new Date(), {\n      addSuffix: true,\n    });\n    const day = dayjs(timeDistance).fromNow(); // plugin\n    expect(m).toBe(d);\n    expect(m).toBe(day);\n    expect(m).toBe(n);\n  });\n\n  it('Time from X', () => {\n    const m = moment([2007, 0, 27]).to(moment([2007, 0, 29]));\n    const d = date.formatDistance(new Date(2007, 0, 27), new Date(2007, 0, 29));\n    const day = dayjs('2007-01-27').to(dayjs('2007-01-29'));\n    expect(m).toContain(d);\n    expect(m).toBe(day);\n  });\n\n  it('Difference', () => {\n    const m = moment([2007, 0, 27]).diff(moment([2007, 0, 29]));\n    const n = new Date(2007, 0, 27) - new Date(2007, 0, 29);\n    const d = date.differenceInMilliseconds(\n      new Date(2007, 0, 27),\n      new Date(2007, 0, 29)\n    );\n    const day = dayjs('2007-01-27').diff(dayjs('2007-01-29'), 'milliseconds');\n    const luxon = DateTime.local(2007, 1, 27).diff(DateTime.local(2007, 1, 29))\n      .milliseconds;\n    expect(m).toBe(d);\n    expect(m).toBe(day);\n    expect(n).toBe(d);\n    expect(n).toBe(m);\n    expect(n).toBe(day);\n    expect(n).toBe(luxon);\n\n    const m2 = moment([2007, 0, 27]).diff(moment([2007, 0, 29]), 'days');\n    const n2 = Math.ceil(\n      (new Date(2007, 0, 27) - new Date(2007, 0, 29)) / 1000 / 60 / 60 / 24\n    );\n    const d2 = date.differenceInDays(\n      new Date(2007, 0, 27),\n      new Date(2007, 0, 29)\n    );\n    const day2 = dayjs('2007-01-27').diff(dayjs('2007-01-29'), 'days');\n    const luxon2 = DateTime.local(2007, 1, 27).diff(\n      DateTime.local(2007, 1, 29),\n      'days'\n    ).days;\n\n    expect(m2).toBe(d2);\n    expect(m2).toBe(day2);\n    expect(n2).toBe(m2);\n    expect(n2).toBe(d2);\n    expect(n2).toBe(day2);\n    expect(n2).toBe(luxon2);\n  });\n});\n\ndescribe('Query', () => {\n  it('Is Before', () => {\n    const m = moment('2010-10-20').isBefore('2010-10-21');\n    const n = new Date(2010, 10, 20) < new Date(2010, 10, 21);\n    const d = date.isBefore(new Date(2010, 9, 20), new Date(2010, 9, 21));\n    const day = dayjs('2010-10-20').isBefore('2010-10-21'); //plugin\n    const luxon =\n      DateTime.fromISO('2010-10-20') < DateTime.fromISO('2010-10-21');\n    expect(m).toBeTruthy();\n    expect(d).toBeTruthy();\n    expect(day).toBeTruthy();\n    expect(n).toBeTruthy();\n    expect(luxon).toBeTruthy();\n  });\n\n  it('Is Same', () => {\n    expect(moment('2010-10-20').isSame('2010-10-21')).toBeFalsy();\n    expect(new Date(2010, 9, 20) === new Date(2010, 9, 21)).toBeFalsy();\n    expect(\n      date.isSameDay(new Date(2010, 9, 20), new Date(2010, 9, 21))\n    ).toBeFalsy();\n    expect(dayjs('2010-10-20').isSame('2010-10-21')).toBeFalsy();\n    expect(\n      +DateTime.fromISO('2010-10-20') === +DateTime.fromISO('2010-10-21')\n    ).toBeFalsy();\n\n    expect(moment('2010-10-20').isSame('2010-10-21', 'month')).toBeTruthy();\n    expect(\n      new Date(2010, 9, 20).valueOf() === new Date(2010, 9, 20).valueOf()\n    ).toBeTruthy();\n    expect(\n      new Date(2010, 9, 20).getTime() === new Date(2010, 9, 20).getTime()\n    ).toBeTruthy();\n    expect(\n      new Date(2010, 9, 20).valueOf() === new Date(2010, 9, 20).getTime()\n    ).toBeTruthy();\n    expect(\n      new Date(2010, 9, 20).toDateString().substring(4, 7) ===\n        new Date(2010, 9, 21).toDateString().substring(4, 7)\n    ).toBeTruthy();\n    expect(\n      date.isSameMonth(new Date(2010, 9, 20), new Date(2010, 9, 21))\n    ).toBeTruthy();\n    expect(\n      DateTime.fromISO('2010-10-20').hasSame(\n        DateTime.fromISO('2010-10-21'),\n        'month'\n      )\n    ).toBeTruthy();\n  });\n\n  it('Is After', () => {\n    const m = moment('2010-10-20').isAfter('2010-10-19');\n    const n = new Date(2010, 10, 20) > new Date(2010, 10, 19);\n    const d = date.isAfter(new Date(2010, 9, 20), new Date(2010, 9, 19));\n    const day = dayjs('2010-10-20').isAfter('2010-10-19');\n    const luxon =\n      DateTime.fromISO('2010-10-20') > DateTime.fromISO('2010-10-19');\n    expect(m).toBeTruthy();\n    expect(n).toBeTruthy();\n    expect(d).toBeTruthy();\n    expect(day).toBeTruthy();\n    expect(luxon).toBeTruthy();\n  });\n\n  it('Is Between', () => {\n    const m = moment('2010-10-20').isBetween('2010-10-19', '2010-10-25');\n    const d = date.isWithinInterval(new Date(2010, 9, 20), {\n      start: new Date(2010, 9, 19),\n      end: new Date(2010, 9, 25),\n    });\n    const day = dayjs('2010-10-20').isBetween('2010-10-19', '2010-10-25'); //plugin\n    const luxon = Interval.fromDateTimes(\n      DateTime.fromISO('2010-10-19'),\n      DateTime.fromISO('2010-10-25')\n    ).contains(DateTime.fromISO('2010-10-20'));\n\n    expect(m).toBeTruthy();\n    expect(d).toBeTruthy();\n    expect(day).toBeTruthy();\n    expect(luxon).toBeTruthy();\n  });\n\n  it('Is Leap Year', () => {\n    expect(moment([2000]).isLeapYear()).toBeTruthy();\n    expect(moment([2001]).isLeapYear()).toBeFalsy();\n    expect(new Date(2000, 1, 29).getDate() === 29).toBeTruthy();\n    expect(date.isLeapYear(new Date(2000, 0, 1))).toBeTruthy();\n    expect(date.isLeapYear(new Date(2001, 0, 1))).toBeFalsy();\n    expect(dayjs('2000-01-01').isLeapYear()).toBeTruthy();\n    expect(dayjs('2001-01-01').isLeapYear()).toBeFalsy();\n    expect(DateTime.local(2000).isInLeapYear).toBeTruthy();\n    expect(DateTime.local(2001).isInLeapYear).toBeFalsy();\n  });\n\n  it('Is a Date', () => {\n    expect(moment.isDate(new Date())).toBeTruthy();\n    expect(new Date() instanceof Date).toBeTruthy();\n    expect(date.isDate(new Date())).toBeTruthy();\n    expect(dayjs.isDayjs(dayjs())).toBeTruthy();\n    expect(DateTime.local().isValid).toBeTruthy();\n  });\n});\n"
  },
  {
    "path": "__tests__/performance.js",
    "content": "const moment = require('moment');\nconst {\n  getSeconds,\n  getHours,\n  setHours,\n  endOfDay,\n  startOfMonth,\n  setSeconds,\n  max,\n  min,\n  getDate,\n  addDays,\n  subDays,\n  setDate,\n  getDay,\n  setDay,\n  getISOWeeksInYear,\n  getDayOfYear,\n  setDayOfYear,\n  setWeek,\n  getWeek,\n  getDaysInMonth,\n} = require('date-fns');\nconst dayjs = require('dayjs');\nconst { DateTime } = require('luxon');\nconst iterations = 1000000;\nconst array = [\n  new Date(2017, 4, 13),\n  new Date(2018, 2, 12),\n  new Date(2016, 0, 10),\n  new Date(2016, 0, 9),\n];\n\nconst performanceTest = (type, testFunction) => {\n  console.time(type);\n  for (let i = 0; i < iterations; i++) {\n    testFunction();\n  }\n  console.timeEnd(type);\n};\n\nconst runTests = object => {\n  for (const key in object) {\n    if (typeof object[key] === 'function') {\n      object[key]();\n    }\n  }\n};\n\nconst Get = {\n  moment: () => {\n    performanceTest('Moment', () => {\n      moment().seconds();\n      moment().hours();\n    });\n  },\n  native: () => {\n    performanceTest('Native', () => {\n      new Date().getSeconds();\n      new Date().getHours();\n    });\n  },\n  dateFns: () => {\n    performanceTest('DateFns', () => {\n      getSeconds(new Date());\n      getHours(new Date());\n    });\n  },\n  dayJs: () => {\n    performanceTest('DayJs', () => {\n      dayjs().second();\n      dayjs().hour();\n    });\n  },\n  luxon: () => {\n    performanceTest('Luxon', () => {\n      DateTime.local().second;\n      DateTime.local().hour;\n    });\n  },\n};\n\n// runTests(Get);\n\nconst Set = {\n  moment: () => {\n    performanceTest('Moment', () => {\n      moment().seconds(30);\n      moment().hours(13);\n    });\n  },\n  native: () => {\n    performanceTest('Native', () => {\n      new Date(new Date().setSeconds(30));\n      new Date(new Date().setHours(13));\n    });\n  },\n  dateFns: () => {\n    performanceTest('DateFns', () => {\n      setSeconds(new Date(), 30);\n      setHours(new Date(), 13);\n    });\n  },\n  dayJs: () => {\n    performanceTest('DayJs', () => {\n      dayjs().set('second', 30);\n      dayjs().set('hour', 13);\n    });\n  },\n  luxon: () => {\n    performanceTest('Luxon', () => {\n      DateTime.utc().set({ second: 30 });\n      DateTime.utc().set({ hour: 13 });\n    });\n  },\n};\n\n// runTests(Set);\n\nconst DateOfMonth = {\n  moment: () => {\n    performanceTest('Moment', () => {\n      moment().date();\n      moment().date(4);\n    });\n  },\n  native: () => {\n    performanceTest('Native', () => {\n      new Date().getDate();\n      new Date().setDate(4);\n    });\n  },\n  dateFns: () => {\n    performanceTest('DateFns', () => {\n      getDate(new Date());\n      setDate(new Date(), 4);\n    });\n  },\n  dayJs: () => {\n    performanceTest('DayJs', () => {\n      dayjs().date();\n      dayjs().set('date', 4);\n    });\n  },\n  luxon: () => {\n    performanceTest('Luxon', () => {\n      DateTime.local().day;\n      DateTime.local().set({ day: 4 });\n    });\n  },\n};\n\n// runTests(DateOfMonth);\n\nconst DayOfWeek = {\n  moment: () => {\n    performanceTest('Moment', () => {\n      moment().day();\n      moment().day(-14);\n    });\n  },\n  native: () => {\n    performanceTest('Native', () => {\n      new Date().getDay();\n      new Date().setDate(new Date().getDate() - 14);\n    });\n  },\n  dateFns: () => {\n    performanceTest('DateFns', () => {\n      getDay(new Date());\n      setDay(new Date(), -14);\n    });\n  },\n  dayJs: () => {\n    performanceTest('DayJs', () => {\n      dayjs().day();\n      dayjs().set('day', -14);\n    });\n  },\n  luxon: () => {\n    performanceTest('Luxon', () => {\n      DateTime.local().weekday;\n      DateTime.local().set({ weekday: -14 });\n    });\n  },\n};\n\n// runTests(DayOfWeek);\n\nconst DayOfYear = {\n  moment: () => {\n    performanceTest('Moment', () => {\n      moment().dayOfYear();\n      moment().dayOfYear(256);\n    });\n  },\n  native: () => {\n    performanceTest('Native', () => {\n      Math.floor(\n        (new Date() - new Date(new Date().getFullYear(), 0, 0)) /\n          1000 /\n          60 /\n          60 /\n          24\n      );\n    });\n  },\n  dateFns: () => {\n    performanceTest('DateFns', () => {\n      getDayOfYear(new Date());\n      setDayOfYear(new Date(), 256);\n    });\n  },\n  luxon: () => {\n    performanceTest('Luxon', () => {\n      DateTime.local().ordinal;\n      DateTime.local().set({ ordinal: 256 });\n    });\n  },\n};\n\n// runTests(DayOfYear);\n\nconst WeekOfYear = {\n  moment: () => {\n    performanceTest('Moment', () => {\n      moment().week();\n      moment().week(24);\n    });\n  },\n  native: () => {\n    performanceTest('Native', () => {\n      const MILLISECONDS_IN_WEEK = 604800000;\n      const firstDayOfWeek = 1;\n\n      const t = new Date();\n      const s = new Date(t.getFullYear(), 0, 1);\n      s.setDate(s.getDate() + ((firstDayOfWeek - s.getDay()) % 7));\n      Math.round((t - s) / MILLISECONDS_IN_WEEK) + 1;\n\n      const d = new Date();\n      const f = new Date(d.getFullYear(), 0, 1);\n      f.setDate(f.getDate() + ((firstDayOfWeek - f.getDay()) % 7));\n      d.setDate(\n        d.getDate() - (Math.round((d - f) / MILLISECONDS_IN_WEEK) + 1 - 24) * 7\n      );\n    });\n  },\n  dateFns: () => {\n    performanceTest('DateFns', () => {\n      getWeek(new Date());\n      setWeek(new Date(), 24);\n    });\n  },\n  luxon: () => {\n    performanceTest('Luxon', () => {\n      DateTime.local().weekYear;\n      DateTime.local().set({ weekYear: 24 });\n    });\n  },\n};\n\n// runTests(WeekOfYear);\n\nconst DaysInMonth = {\n  moment: () => {\n    performanceTest('Moment', () => {\n      moment('2012-02', 'YYYY-MM').daysInMonth();\n    });\n  },\n  native: () => {\n    performanceTest('Native', () => {\n      new Date(2012, 2, 0).getDate();\n    });\n  },\n  dateFns: () => {\n    performanceTest('DateFns', () => {\n      getDaysInMonth(new Date(2012, 2));\n    });\n  },\n  dayJs: () => {\n    performanceTest('DayJs', () => {\n      dayjs('2012-02').daysInMonth();\n    });\n  },\n  luxon: () => {\n    performanceTest('Luxon', () => {\n      DateTime.local(2012, 2).day;\n    });\n  },\n};\n\n// runTests(DaysInMonth);\n\nconst WeeksInYear = {\n  moment: () => {\n    performanceTest('Moment', () => {\n      moment().isoWeeksInYear();\n    });\n  },\n  dateFns: () => {\n    performanceTest('DateFns', () => {\n      getISOWeeksInYear(new Date());\n    });\n  },\n  luxon: () => {\n    performanceTest('Luxon', () => {\n      DateTime.local().weeksInWeekYear;\n    });\n  },\n};\n\n// runTests(WeeksInYear);\n\nconst MaximumOfGivenDates = {\n  moment: () => {\n    performanceTest('Moment', () => {\n      moment.max(array.map(a => moment(a)));\n    });\n  },\n  native: () => {\n    performanceTest('Native', () => {\n      new Date(Math.max.apply(null, array)).toISOString();\n    });\n  },\n  dateFns: () => {\n    performanceTest('DateFns', () => {\n      max(array);\n    });\n  },\n  luxon: () => {\n    performanceTest('Luxon', () => {\n      const dates = array.map(a => DateTime.fromJSDate(a));\n      DateTime.max(...dates);\n    });\n  },\n};\n\n// runTests(MaximumOfGivenDates);\n\nconst MinimumOfGivenDates = {\n  moment: () => {\n    performanceTest('Moment', () => {\n      moment.min(array.map(a => moment(a)));\n    });\n  },\n  native: () => {\n    performanceTest('Native', () => {\n      new Date(Math.min.apply(null, array)).toISOString();\n    });\n  },\n  dateFns: () => {\n    performanceTest('DateFns', () => {\n      min(array);\n    });\n  },\n  luxon: () => {\n    performanceTest('Luxon', () => {\n      const dates = array.map(a => DateTime.fromJSDate(a));\n      DateTime.min(...dates);\n    });\n  },\n};\n\n// runTests(MinimumOfGivenDates);\n\nconst Add = {\n  moment: () => {\n    performanceTest('Moment', () => {\n      moment().add(7, 'days');\n    });\n  },\n  native: () => {\n    performanceTest('Native', () => {\n      const now = new Date();\n      now.setDate(now.getDate() + 7);\n    });\n  },\n  dateFns: () => {\n    performanceTest('DateFns', () => {\n      addDays(new Date(), 7);\n    });\n  },\n  dayJs: () => {\n    performanceTest('DayJs', () => {\n      dayjs().add(7, 'day');\n    });\n  },\n  luxon: () => {\n    performanceTest('Luxon', () => {\n      DateTime.local().plus({ day: 7 });\n    });\n  },\n};\n\n// runTests(Add);\n\nconst Subtract = {\n  moment: () => {\n    performanceTest('Moment', () => {\n      moment().subtract(7, 'days');\n    });\n  },\n  native: () => {\n    performanceTest('Native', () => {\n      new Date(new Date().getTime() - 1000 * 60 * 60 * 24 * 7);\n    });\n  },\n  dateFns: () => {\n    performanceTest('DateFns', () => {\n      subDays(new Date(), 7);\n    });\n  },\n  dayJs: () => {\n    performanceTest('DayJs', () => {\n      dayjs().subtract(7, 'day');\n    });\n  },\n  luxon: () => {\n    performanceTest('Luxon', () => {\n      DateTime.local().minus({ day: 7 });\n    });\n  },\n};\n\n// runTests(Subtract);\n\nconst StartOfTime = {\n  moment: () => {\n    performanceTest('Moment', () => {\n      moment().startOf('month');\n    });\n  },\n  dateFns: () => {\n    performanceTest('DateFns', () => {\n      startOfMonth(new Date());\n    });\n  },\n  dayJs: () => {\n    performanceTest('DayJs', () => {\n      dayjs().startOf('month');\n    });\n  },\n  luxon: () => {\n    performanceTest('Luxon', () => {\n      DateTime.local().startOf('month');\n    });\n  },\n};\n\n// runTests(StartOfTime);\n\nconst EndOfTime = {\n  moment: () => {\n    performanceTest('Moment', () => {\n      moment().endOf('day');\n    });\n  },\n  native: () => {\n    performanceTest('Native', () => {\n      new Date().setHours(23, 59, 59, 999);\n    });\n  },\n  dateFns: () => {\n    performanceTest('DateFns', () => {\n      endOfDay(new Date());\n    });\n  },\n  dayJs: () => {\n    performanceTest('DayJs', () => {\n      dayjs().endOf('day');\n    });\n  },\n  luxon: () => {\n    performanceTest('Luxon', () => {\n      DateTime.local().endOf('day');\n    });\n  },\n};\n\n// runTests(EndOfTime);\n"
  },
  {
    "path": "docs/.nojekyll",
    "content": ""
  },
  {
    "path": "docs/README.md",
    "content": "[remoteMarkdownUrl](https://raw.githubusercontent.com/you-dont-need/You-Dont-Need-Momentjs/master/README.md)\n"
  },
  {
    "path": "docs/index.html",
    "content": "<!DOCTYPE html>\n<html lang=\"en\">\n  <head>\n    <meta charset=\"UTF-8\" />\n    <title>You don't (may not) need Moment.js</title>\n    <meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge,chrome=1\" />\n    <meta name=\"description\" content=\"Description\" />\n    <meta\n      name=\"viewport\"\n      content=\"width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0\"\n    />\n    <link\n      rel=\"stylesheet\"\n      href=\"//cdn.jsdelivr.net/npm/docsify/lib/themes/vue.css\"\n    />\n  </head>\n  <body>\n    <div id=\"app\"></div>\n    <script>\n      window.$docsify = {\n        name: \"You don't need Momentjs\",\n        nameLink: '/',\n        repo: 'https://github.com/you-dont-need/You-Dont-Need-Momentjs',\n        autoHeader: true,\n        maxLevel: 3,\n        markdown: {\n          smartypants: true,\n        },\n\n        remoteMarkdown: {\n          tag: 'remoteMarkdownUrl',\n        },\n      };\n    </script>\n    <script src=\"//cdn.jsdelivr.net/npm/docsify/lib/docsify.min.js\"></script>\n    <script src=\"//unpkg.com/docsify-remote-markdown/dist/docsify-remote-markdown.min.js\"></script>\n    <script src=\"//cdn.jsdelivr.net/npm/prismjs@1/components/prism-js-extras.min.js\"></script>\n    <script src=\"//cdn.jsdelivr.net/npm/prismjs@1/components/prism-js-templates.min.js\"></script>\n    <script src=\"//cdn.jsdelivr.net/npm/prismjs@1/components/prism-jsdoc.min.js\"></script>\n  </body>\n</html>\n"
  },
  {
    "path": "lib/__tests__/index.js",
    "content": "const rule = require('../').rules;\nconst RuleTester = require('eslint').RuleTester;\n\nRuleTester.setDefaultConfig({\n  parser: 'babel-eslint',\n  parserOptions: {\n    ecmaVersion: 6,\n    sourceType: 'module',\n  },\n});\n\nvar ruleTester = new RuleTester();\n\ndescribe('ESLint plugin', () => {\n  ruleTester.run('no-dynamic-import-moment', rule['no-dynamic-import-moment'], {\n    valid: [\"import('date-fns').then()\"],\n    invalid: [\n      {\n        code: \"import('moment').then(()=>{})\",\n        errors: [\n          {\n            message: 'Use date-fns or Native Date methods instead of moment.js',\n            type: 'CallExpression',\n          },\n        ],\n      },\n      {\n        code: \"(async () => { const m = await import('moment'); })()\",\n        errors: [\n          {\n            message: 'Use date-fns or Native Date methods instead of moment.js',\n            type: 'CallExpression',\n          },\n        ],\n      },\n    ],\n  });\n\n  ruleTester.run('no-import-moment', rule['no-import-moment'], {\n    valid: [\n      \"import { format, formatDistance, formatRelative, subDays } from 'date-fns'\",\n    ],\n    invalid: [\n      {\n        code: \"import moment from 'moment'\",\n        errors: [\n          {\n            message: 'Use date-fns or Native Date methods instead of moment.js',\n            type: 'ImportDeclaration',\n          },\n        ],\n      },\n      {\n        code: \"import * as moment from 'moment'\",\n        errors: [\n          {\n            message: 'Use date-fns or Native Date methods instead of moment.js',\n            type: 'ImportDeclaration',\n          },\n        ],\n      },\n    ],\n  });\n\n  ruleTester.run('no-moment-constructor', rule['no-moment-constructor'], {\n    valid: ['new Date()', 'Date()'],\n    invalid: [\n      {\n        code: 'moment()',\n        errors: [\n          {\n            message: 'Consider using Native new Date().',\n            type: 'CallExpression',\n          },\n        ],\n      },\n      {\n        code: \"moment('12-25-1995')\",\n        errors: [\n          {\n            message: 'Consider using Native new Date().',\n            type: 'CallExpression',\n          },\n        ],\n      },\n      {\n        code: \"moment('12-25-1995', 'MM-DD-YYYY')\",\n        errors: [\n          {\n            message:\n              'Consider using date-fns, e.g. parse(\"2010-10-20 4:30\", \"yyyy-MM-dd H:mm\", new Date()).',\n            type: 'CallExpression',\n          },\n        ],\n      },\n    ],\n  });\n\n  ruleTester.run('no-moment-methods/seconds', rule['seconds'], {\n    valid: [],\n    invalid: [\n      {\n        code: 'moment().seconds()',\n        errors: [\n          {\n            message:\n              'Consider using new Date().getSeconds() or new Date().setSeconds()',\n            type: 'CallExpression',\n          },\n        ],\n      },\n    ],\n  });\n\n  ruleTester.run('no-moment-methods/seconds', rule['seconds'], {\n    valid: [],\n    invalid: [\n      {\n        code: \"moment()['seconds']();\",\n        errors: [\n          {\n            message:\n              'Consider using new Date().getSeconds() or new Date().setSeconds()',\n            type: 'CallExpression',\n          },\n        ],\n      },\n    ],\n  });\n\n  ruleTester.run('no-moment-methods/is-after', rule['is-after'], {\n    valid: [],\n    invalid: [\n      {\n        code: \"const m = moment('2010-10-20').isAfter('2010-10-19')\",\n        errors: [\n          {\n            message:\n              'Consider using date-fns isAfter(date, dateToCompare) or dayjs().isAfter()',\n            type: 'CallExpression',\n          },\n        ],\n      },\n    ],\n  });\n\n  ruleTester.run('no-require-moment', rule['no-require-moment'], {\n    valid: [\n      \"var { format, formatDistance, formatRelative, subDays } = require('date-fns')\",\n      'var empty = require()',\n      'var other = r()',\n    ],\n    invalid: [\n      {\n        code: \"var moment = require('moment')\",\n        errors: [\n          {\n            message: 'Use date-fns or Native Date methods instead of moment.js',\n            type: 'CallExpression',\n          },\n        ],\n      },\n      {\n        code: \"var format = require('moment').format\",\n        errors: [\n          {\n            message: 'Use date-fns or Native Date methods instead of moment.js',\n            type: 'CallExpression',\n          },\n        ],\n      },\n    ],\n  });\n});\n"
  },
  {
    "path": "lib/index.js",
    "content": "const rules = Object.assign(\n  {},\n  {\n    'no-dynamic-import-moment': require('./rules/no-dynamic-import-moment'),\n    'no-import-moment': require('./rules/no-import-moment'),\n    'no-moment-constructor': require('./rules/no-moment-constructor'),\n    'no-require-moment': require('./rules/no-require-moment'),\n  },\n  require('./rules/no-moment-methods')\n);\n\nmodule.exports.rules = rules;\n\nconst configure = (list, level) => {\n  const r = {};\n  Object.keys(list).map(rule => (r['you-dont-need-momentjs/' + rule] = level));\n  return r;\n};\n\nmodule.exports.configs = {\n  recommended: {\n    plugins: ['you-dont-need-momentjs'],\n    rules: configure(rules, 2),\n  },\n};\n"
  },
  {
    "path": "lib/rules/methods.json",
    "content": "{\n  \"seconds\": {\n    \"alternative\": \"new Date().getSeconds() or new Date().setSeconds()\"\n  },\n  \"hours\": {\n    \"alternative\": \"new Date().getHours() or new Date().setHours()\"\n  },\n  \"date\": {\n    \"alternative\": \"new Date().getDate() or new Date().setDate()\"\n  },\n  \"day\": {\n    \"alternative\": \"new Date().getDay() or new Date().setDate()\"\n  },\n  \"dayOfYear\": {\n    \"alternative\": \"date-fns getDayOfYear(date) or setDayOfYear(date, dayOfYear)\"\n  },\n  \"week\": {\n    \"alternative\": \"date-fns getWeek(date) or setWeek(date, week)\"\n  },\n  \"isoWeeksInYear\": {\n    \"alternative\": \"date-fns getISOWeeksInYear(date)\"\n  },\n  \"max\": {\n    \"alternative\": \"date-fns max(date)\"\n  },\n  \"min\": {\n    \"alternative\": \"date-fns min(date)\"\n  },\n  \"add\": {\n    \"alternative\": \"date-fns addDays(date, amount) or dayjs().add(number, unit)\"\n  },\n  \"subtract\": {\n    \"alternative\": \"date-fns subDays(date, amount) or dayjs().subtract(number, unit)\"\n  },\n  \"startOf\": {\n    \"alternative\": \"date-fns startOfMonth(date) or dayjs().startOf(unit)\"\n  },\n  \"endOf\": {\n    \"alternative\": \"date-fns endOfDay(date) or dayjs().endOf(unit)\"\n  },\n  \"format\": {\n    \"alternative\": \"date-fns format(date, format) or dayjs().format()\"\n  },\n  \"fromNow\": {\n    \"alternative\": \"date-fns formatDistance(date, baseDate)\"\n  },\n  \"to\": {\n    \"alternative\": \"date-fns formatDistance(date, baseDate)\"\n  },\n  \"diff\": {\n    \"alternative\": \"date-fns differenceInMilliseconds(dateLeft, dateRight) or dayjs().diff()\"\n  },\n  \"daysInMonth\": {\n    \"alternative\": \"date-fns getDaysInMonth(date) or dayjs().daysInMonth();\"\n  },\n  \"isBefore\": {\n    \"alternative\": \"date-fns isBefore(date, dateToCompare) or dayjs().isBefore()\"\n  },\n  \"isSame\": {\n    \"alternative\": \"date-fns isSameMonth(dateLeft, dateRight) or dayjs().isSame()\"\n  },\n  \"isAfter\": {\n    \"alternative\": \"date-fns isAfter(date, dateToCompare) or dayjs().isAfter()\"\n  },\n  \"isBetween\": {\n    \"alternative\": \"date-fns isWithinInterval(date, interval)\"\n  },\n  \"isLeapYear\": {\n    \"alternative\": \"date-fns isLeapYear(date)\"\n  },\n  \"isDate\": {\n    \"alternative\": \"date-fns isDate(date)\"\n  }\n}\n"
  },
  {
    "path": "lib/rules/no-dynamic-import-moment.js",
    "content": "var message = 'Use date-fns or Native Date methods instead of moment.js';\n\nmodule.exports = function(context) {\n  return {\n    CallExpression: function(node) {\n      if (node.callee.type !== 'Import') {\n        return;\n      }\n\n      var arg = node.arguments[0];\n\n      if (arg.type === 'Literal' && arg.value === 'moment') {\n        context.report(node, message);\n      }\n    },\n  };\n};\n"
  },
  {
    "path": "lib/rules/no-import-moment.js",
    "content": "module.exports = function(context) {\n  return {\n    ImportDeclaration: function(node) {\n      node.specifiers.forEach(function(specifier) {\n        if (\n          (specifier.type === 'ImportDefaultSpecifier' ||\n            specifier.type === 'ImportNamespaceSpecifier') &&\n          specifier.local.type === 'Identifier' &&\n          specifier.local.name === 'moment'\n        ) {\n          context.report(\n            node,\n            'Use date-fns or Native Date methods instead of moment.js'\n          );\n        }\n      });\n    },\n  };\n};\n"
  },
  {
    "path": "lib/rules/no-moment-constructor.js",
    "content": "module.exports = function(context) {\n  return {\n    CallExpression(node) {\n      if (node.callee.name === 'moment') {\n        if (node.arguments.length === 0 || node.arguments.length === 1) {\n          context.report({\n            node,\n            message: `Consider using Native new Date().`,\n          });\n        } else {\n          context.report({\n            node,\n            message: `Consider using date-fns, e.g. parse(\"2010-10-20 4:30\", \"yyyy-MM-dd H:mm\", new Date()).`,\n          });\n        }\n      }\n    },\n  };\n};\n"
  },
  {
    "path": "lib/rules/no-moment-methods.js",
    "content": "const kebabCase = require('kebab-case');\nconst rules = require('./methods');\n\nfor (const rule in rules) {\n  const alternative = rules[rule].alternative;\n  const ruleName = rules[rule].ruleName || kebabCase(rule);\n  module.exports[ruleName] = {\n    create(context) {\n      return {\n        CallExpression(node) {\n          const callee = node.callee;\n          const objectName =\n            callee.name ||\n            (callee.object && callee.object.name) ||\n            (callee.object &&\n              callee.object.callee &&\n              callee.object.callee.name);\n          if (\n            objectName === 'moment' &&\n            callee.property &&\n            (callee.property.name === rule || callee.property.value === rule)\n          ) {\n            context.report({\n              node,\n              message: `Consider using ${alternative}`,\n            });\n          }\n        },\n      };\n    },\n  };\n}\n"
  },
  {
    "path": "lib/rules/no-require-moment.js",
    "content": "module.exports = function(context) {\n  return {\n    CallExpression: function(node) {\n      if (node.callee.type === 'Identifier' && node.callee.name === 'require') {\n        var arg = node.arguments[0];\n\n        if (arg && arg.type === 'Literal' && arg.value === 'moment') {\n          context.report(\n            node,\n            'Use date-fns or Native Date methods instead of moment.js'\n          );\n        }\n      }\n    },\n  };\n};\n"
  },
  {
    "path": "package.json",
    "content": "{\n  \"name\": \"eslint-plugin-you-dont-need-momentjs\",\n  \"description\": \"Check better alternatives you can use without momentjs\",\n  \"version\": \"1.6.0\",\n  \"repository\": {\n    \"type\": \"git\",\n    \"url\": \"https://github.com/you-dont-need/You-Dont-Need-Momentjs.git\"\n  },\n  \"keywords\": [\n    \"moment-js\",\n    \"date-fns\",\n    \"dayjs\",\n    \"luxon\",\n    \"eslint\",\n    \"eslintplugin\",\n    \"eslint-plugin\",\n    \"tree-shaking\",\n    \"you-dont-need\"\n  ],\n  \"author\": \"Andrew Yang <ddvkid@gmail.com>\",\n  \"contributors\": [\n    \"Robert Chang <cht8687@gmail.com>\",\n    \"Jago MF <jagomf@gmail.com> (https://github.com/jagomf)\",\n    \"Steve Mao <maochenyan@gmail.com> (https://github.com/stevemao)\",\n    \"CY Lim <cylim@pm.me> (https://l.cy.my/github)\"\n  ],\n  \"main\": \"lib/index.js\",\n  \"scripts\": {\n    \"test:watch\": \"jest --watch\",\n    \"test\": \"jest --coverage\",\n    \"test:perf\": \"node ./__tests__/performance.js\",\n    \"coveralls\": \"cat ./coverage/lcov.info | coveralls\",\n    \"precommit\": \"pretty-quick --staged\"\n  },\n  \"devDependencies\": {\n    \"babel-eslint\": \"^10.1.0\",\n    \"coveralls\": \"^3.0.2\",\n    \"date-fns\": \"^2.0.0\",\n    \"dayjs\": \"^1.8.15\",\n    \"eslint\": \"^5.5.0\",\n    \"husky\": \"^0.14.3\",\n    \"jest\": \"^29.6.2\",\n    \"luxon\": \"^1.17.2\",\n    \"moment\": \"^2.24.0\",\n    \"prettier\": \"^1.14.2\",\n    \"pretty-quick\": \"^1.6.0\"\n  },\n  \"dependencies\": {\n    \"kebab-case\": \"^1.0.0\"\n  },\n  \"peerDependencies\": {\n    \"eslint\": \"^5.5.0 || ^7.0.0\"\n  },\n  \"jest\": {\n    \"collectCoverageFrom\": [\n      \"lib/**/*.js\"\n    ],\n    \"testPathIgnorePatterns\": [\n      \"<rootDir>/node_modules/\",\n      \"./__tests__/performance.js\"\n    ]\n  },\n  \"license\": \"MIT\",\n  \"bugs\": {\n    \"url\": \"https://github.com/you-dont-need/You-Dont-Need-Momentjs/issues\"\n  }\n}\n"
  }
]