{"_id":"dayjs-recur","_rev":"4-707d17a1d201dd4ff558d7f3e33147f5","name":"dayjs-recur","dist-tags":{"latest":"1.0.1"},"versions":{"0.0.2":{"name":"dayjs-recur","version":"0.0.2","description":"A Day.js plugin for matching and generating recurring dates.","main":"index.min.js","module":"index.min.js","license":"MIT","author":{"name":"Fraser Hamilton"},"scripts":{"build":"rollup --config","minify":"terser build/index.js --compress --mangle --output index.min.js","build:minify":"yarn build && yarn minify","test":"jest --watch"},"keywords":["day.js","dayjs","date","recur","match"],"repository":{"type":"git","url":"https://github.com/FraserHamilton/dayjs-recur.git"},"devDependencies":{"@babel/core":"^7.10.3","@babel/preset-env":"^7.10.3","babel-jest":"^26.1.0","dayjs":"^1.8.33","jest":"^26.1.0","prettier":"^2.0.5","rollup":"^2.18.0","terser":"^4.8.0"},"_id":"dayjs-recur@0.0.2","dist":{"shasum":"2bb2da8c6db9f037fcf9a54ce31020cb45af17d5","integrity":"sha512-mTrmmax3OHcsvIE5XakznVuRzVUKvpY4C9AelVhtyyF8c9sB7ljjL9a1N4bBTgfEe3ClG3a/w/XBC0QRSQMD+A==","tarball":"https://registry.npmjs.org/dayjs-recur/-/dayjs-recur-0.0.2.tgz","fileCount":4,"unpackedSize":10061,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfOpZ8CRA9TVsSAnZWagAA8ZwP/RYtOA+LIHsW7qiSgQ24\nEoiG8NIePGlxM+7Dqqi/RYy2gqrSwclgPlGvlTJJZDEJDnlG7tYp4cdP7m7h\nVXfXF0MVWbOviDMnvMsISLDlJYbPk3DmDsNJ0BsOWQmg7aXRx7jrlZXu1D8T\nKw3bMcFb6SaEkGh7CwsEz9udlfUO0yVPOCqU8wDekOYOaYFoAV5Gs9A3vpnD\nX0qYUlNezAp96WoZ1AlcT5KSbcFAh3LxZ6IpOZwguu/iA6XmU3HlYnoHZkDi\nysu21sg9YgtnhPn6AuTWhueBMv5LedYMSsa88zcFSw8yzpgA0g1nR/MJblLk\naQt8sNJ5EO1OjXKaGHtx0kCV9EzrBVqEpYTTiKj/ECifJK3J1UCK/vFvYD2u\nOzfnpGUB+pXB2946fBN9gJ6APRtJkMJf+tnPxLthPcZwtjAknXGBwGCp9Fb1\nHibFFwX16FQKOUjesWzzL0z+LGYT1AaneJ7NHQNdTZiQ71YhwGsNQwcSZEBB\n4fUgkYM5yn6vOlgUrvbhnRA3wayLpFIeOICz3vyhOA42TkdhUv2bZ/qWGIjg\nrfu+mu4tJXgkee8HF4jBPdGV6wXVRGYRAnWVdYzp4pXt1Rj1pgnqEVJQ7+7c\npHbSMYThXt8e8FmGXpGrqmmmqaiC4gxR4UGsJgaTK8k4CE6q3APkiUuUbEhM\ntNV8\r\n=/B5a\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCHSrxZLrxlwFNoQaJle/t8D+VuFH7fi7kM7eGuOmdDKQIhAIIj982QDguBbDUnBzzAmJfaNO/OTgKmDgNmQ1yJsF/X"}]},"maintainers":[{"name":"fraserhamilton","email":"fraserhamiltonsoftware@gmail.com"}],"_npmUser":{"name":"fraserhamilton","email":"fraserhamiltonsoftware@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/dayjs-recur_0.0.2_1597675131890_0.8380661736985549"},"_hasShrinkwrap":false},"0.0.3":{"name":"dayjs-recur","version":"0.0.3","description":"A Day.js plugin for matching and generating recurring dates.","main":"index.min.js","module":"index.min.js","license":"MIT","author":{"name":"Fraser Hamilton"},"scripts":{"build":"rollup --config","minify":"terser build/index.js --compress --mangle --output index.min.js","build:minify":"yarn build && yarn minify","test":"jest --watch"},"keywords":["day.js","dayjs","date","recur","match"],"repository":{"type":"git","url":"https://github.com/FraserHamilton/dayjs-recur.git"},"devDependencies":{"@babel/core":"^7.10.3","@babel/preset-env":"^7.10.3","babel-jest":"^26.1.0","dayjs":"^1.8.33","jest":"^26.1.0","prettier":"^2.0.5","rollup":"^2.18.0","terser":"^4.8.0"},"licenseText":"MIT License\n\nCopyright (c) 2020 Fraser Hamilton\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","_id":"dayjs-recur@0.0.3","dist":{"shasum":"741b81279427a97e8826af7372277b88dccbc8ee","integrity":"sha512-46KlXJ5F/zQ7Azk5IZKrgPLpEdNvmHBpSOOEg8SAUbOhB04iROAPoLoyU01TLGHt6/z/aTOziREBWozzrFzLuA==","tarball":"https://registry.npmjs.org/dayjs-recur/-/dayjs-recur-0.0.3.tgz","fileCount":5,"unpackedSize":20436,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfOqCLCRA9TVsSAnZWagAAWScQAI/ZZmcNYh/kxb6BCvIv\niFGUfARmYGtd2XlC6FCSw3Lmfo1Yjl1VHR7a51xOJqnTLetXYnGxmUWegUfp\nADtn0h8l/GqrGBlu56hq02QVRAShsEfSUXfY71AcSV+6TCcWhrTGOurLkFND\nAnAgWPQKdoDel8SoIZxp3cXKzXxNJtafdkMLhMqE8H1Nz2mtknjuFsyT4HbP\nK11fcbf3NDxU9vCxXDjR1Me0/hR27F8Ch78Z9a13lcsfrOkbo69bqiTuzLnB\nX6FpN8NgUjhBdrXEE8YOK0GU6qDRgF1cUsL303xcsHAK6dhvkSmxB8iQc/Lo\na6IrmEL3HsR4KOZUy+PYA+nGPuNzzr23PKi/OsNSi6jNKhYeW8ZjHXYWj5WS\n0xQMQFO8bqeQ9XOC7riSiIkpFR+goGplQWp875XuywxvrdAIVSZkIvsAm0po\nAJqctR63u5BH/CJiEb3lVJYxQ4EMp3QoMLSgR1iVrtNV7lNNIdFjYe+FGHUB\nSaNfyWmGo2CO0Vu6KZhxQF5M1YYX7wcn8vQTvM8dzF27DVk9k77y0NeihKRH\nfO+AgZCLFjJb1iTiWTbqHMgPAa405S+la8GkEOQkh83n4reuzQZ0E9dCbFlL\njkfJLuVeEvrPzEhnvq3HlirbfrzH9CF1CAOA2TKsXkRU7sjWp/vNHVlLAJEW\nE8kl\r\n=n3m7\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQD7gPWx36J+GGN+ZdoqI5UGU7W6Z+pMaUP79UDKuhpGeQIhALton3vHO0a/SzQN7tOZDx/RYv9s3yqrXbzmUYKH0ny2"}]},"maintainers":[{"name":"fraserhamilton","email":"fraserhamiltonsoftware@gmail.com"}],"_npmUser":{"name":"fraserhamilton","email":"fraserhamiltonsoftware@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/dayjs-recur_0.0.3_1597677707160_0.8753011408122113"},"_hasShrinkwrap":false},"1.0.0":{"name":"dayjs-recur","version":"1.0.0","description":"A Day.js plugin for matching and generating recurring dates.","main":"index.min.js","module":"index.min.js","license":"MIT","author":{"name":"Fraser Hamilton"},"scripts":{"build":"rollup --config","minify":"terser build/index.js --compress --mangle --output index.min.js","build:minify":"yarn build && yarn minify","test":"jest --watch"},"keywords":["day.js","dayjs","date","recur","match"],"repository":{"type":"git","url":"https://github.com/FraserHamilton/dayjs-recur.git"},"devDependencies":{"@babel/core":"^7.10.3","@babel/preset-env":"^7.10.3","babel-jest":"^26.1.0","dayjs":"^1.8.33","jest":"^26.1.0","prettier":"^2.0.5","rollup":"^2.18.0","terser":"^4.8.0"},"licenseText":"MIT License\n\nCopyright (c) 2020 Fraser Hamilton\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","_id":"dayjs-recur@1.0.0","dist":{"shasum":"1a0e7fb8f73bf6e6a71d0bc0121f09a22d4b3a13","integrity":"sha512-BHqSgsx4iK4yydszzghy3Z2UL2YmRVaIhMyxbo9yCAYJeVTg7daxTnkAUpPm3EoIHlUcO5y8kBV3vAntb8JhFQ==","tarball":"https://registry.npmjs.org/dayjs-recur/-/dayjs-recur-1.0.0.tgz","fileCount":5,"unpackedSize":20436,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfOqFFCRA9TVsSAnZWagAAE0gP/jOqX5u5O+9TrMSzbyhQ\nCr8DF9tjXaH8NcmjF0kBhWxSJwDdIQYSbhPYwdUL6fW5d5Hh6K38lmui47Uq\nxH59cE8JNtH/6/YLqWq4Nw9is9GnjwhWYS95RnjzT2YV9qiUeaW/mcQezzZS\nKvoHaG7Yvj43j+QITe37MCtEoGxltYdzc15jURj0mOXvdqvbu35i/AK42FPt\nJKpVceCvA7zGUZDzkFwUOldWI3Nn7Fdq7WHa/PaYfqFgh9GALHwmnVreWHfl\n8/G+xPcE1vsq0rvIbb0CN+k6krri2LXFVPA+PQ5z+tqNuK1YJiGjoNAXQs4j\nK9oBlGx6DK6zxrFCXS5p0bWg1a6WEyw9VHWtTHcThv5QoTC5bbRbHCfrrIKn\nGLCSES7sAb0HmhVJVa5zMBiJ65kvsqlubf4RjrlXDaUX5BREjfgk+R3dPmVN\nASaYAsVlTi7mMh1zijv9KRwrT+7oOMpJ0SDOL8AEPR0wZP1580dk8PuYmspl\nrsjbe8J8NT566x3sd6yIoaMOJxT1uX+KvgXx/rUC2vl9FPHAen1C7qnbQnIk\n5VpZSxcEDjlgQNwEJ3Jx8swHsSy7iYSgfWtmHZWPZsJaMp5kxWfffyl7AO9R\n0zJxsEteaanyElH2KIEKwF2P6PyyBnA88SfkPjiYFJuy0x3hpbbB7yXC+iQW\n2LtU\r\n=Shsu\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCH4lQOIiQ77g3f2WBvBaz73xEV9qJnKWuk7LGUifQ+DQIgNu5j6bpDEBxYuaHx+pYTdCwCuycPHVftUvxLvnQRdes="}]},"maintainers":[{"name":"fraserhamilton","email":"fraserhamiltonsoftware@gmail.com"}],"_npmUser":{"name":"fraserhamilton","email":"fraserhamiltonsoftware@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/dayjs-recur_1.0.0_1597677892506_0.05754184297017906"},"_hasShrinkwrap":false},"1.0.1":{"name":"dayjs-recur","version":"1.0.1","description":"A Day.js plugin for matching and generating recurring dates.","main":"index.min.js","module":"index.min.js","license":"MIT","author":{"name":"Fraser Hamilton"},"scripts":{"build":"rollup --config","minify":"terser build/index.js --compress --mangle --output index.min.js","build:minify":"yarn build && yarn minify","test":"jest --watch"},"keywords":["day.js","dayjs","date","recur","match"],"repository":{"type":"git","url":"git+https://github.com/FraserHamilton/dayjs-recur.git"},"devDependencies":{"@babel/core":"^7.10.3","@babel/preset-env":"^7.10.3","babel-jest":"^26.1.0","dayjs":"^1.10.8","jest":"^27.5.1","prettier":"^2.0.5","rollup":"^2.18.0","terser":"^4.8.0"},"gitHead":"de02364a681b42f517624ff131db443437d2b800","bugs":{"url":"https://github.com/FraserHamilton/dayjs-recur/issues"},"homepage":"https://github.com/FraserHamilton/dayjs-recur#readme","_id":"dayjs-recur@1.0.1","_nodeVersion":"14.17.1","_npmVersion":"6.14.13","dist":{"integrity":"sha512-guVj/GSfwZ/i6RQwzXzW9jCwXBqD50gFQxn/CCt7M9YZ0n9w1kly0FhIA+7Z2H6mqTL53NDhMXoN7YvcYCaVUg==","shasum":"3f9844bed68d25018347ef60116b0b4d3465bc47","tarball":"https://registry.npmjs.org/dayjs-recur/-/dayjs-recur-1.0.1.tgz","fileCount":4,"unpackedSize":20436,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJiLS9IACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmow0A/9F8R3HnddWHAYbeJEl0hxV6cR1yZLJFvg2y9EUBhnlNOpvB83\r\nIuLdB3TYMfQNXnlIeQqrRGS9z+6aowGZEg1URDnT9lyrL4N7+hcpn801jC3q\r\n3pyhMyv3p0sUVFdgrIhsfnS5/gmKYoM/1WH8kRj0l++4eydUaDdKBapeW7d0\r\ndxIq1hMZGne5BmgGaGaJyUaZTWjPfQeq6chPo8ifzxBv/Js59rhWyHMNb2Tj\r\ns9pk8zEwR8pj0iBaco2mCmK3FVtu2qhYVOiqvFZDXKiXXOYnVPFgt9kXM0XH\r\noa3/T8mbgGPQZ3mzO4ZO5hvdYdfeLa9efvcbj/C7w5/nf3mtVjrWoYZioJjU\r\nCpcbGX73qgK1AUANSQQmB/eMtEC2QM8Px0hJ7Na9+0lqmvMRL51THjGlkUPY\r\nxPMm0DRk5IXUuv4RcGELsCJ9RkJwOShSrkXTx6TmJweMIi9/CRuYMsD7ah5n\r\npf4VtGHnYmcyzs7pawD079DqDwu/0wMmjghqpdfUj0tbxDccpCGejuuTy8NR\r\nrPr+BDA9CYnKZCLkd1uqPUjfm59kqhSCcUk5qnMPMGn4yanSz8Fs2RQrHEZX\r\nxPR+eDNyRF3gRvy0MrIxxcE0zNrh9CKRLfFcr1o/MsjsNWyk8Kt7PBIbBTY+\r\nf6TUFJO3PnAKjtYCx4xMrn3t4By1VzygloU=\r\n=pUPm\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIES7dDF2MRAT0pnRs6WF9OYDrD/Mljgk5GsEHZZ/qZ5qAiEAij8Rkp3zHTakPfCAWt8y4GisYLwIg4wvLnprkQTDtnw="}]},"_npmUser":{"name":"fraserhamilton","email":"fraserhamiltonsoftware@gmail.com"},"directories":{},"maintainers":[{"name":"fraserhamilton","email":"fraserhamiltonsoftware@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/dayjs-recur_1.0.1_1647128392861_0.9696721347697694"},"_hasShrinkwrap":false}},"time":{"created":"2020-08-17T14:38:51.890Z","0.0.2":"2020-08-17T14:38:52.003Z","modified":"2022-04-28T06:31:20.869Z","0.0.3":"2020-08-17T15:21:47.387Z","1.0.0":"2020-08-17T15:24:52.607Z","1.0.1":"2022-03-12T23:39:52.987Z"},"maintainers":[{"name":"fraserhamilton","email":"fraserhamiltonsoftware@gmail.com"}],"description":"A Day.js plugin for matching and generating recurring dates.","keywords":["day.js","dayjs","date","recur","match"],"repository":{"type":"git","url":"git+https://github.com/FraserHamilton/dayjs-recur.git"},"author":{"name":"Fraser Hamilton"},"license":"MIT","readme":"# dayjs-recur\r\n\r\nThis is a plugin for [Day.js](https://github.com/iamkun/dayjs) that allows you to work with recurring dates. This plugin only handles dates, any time information is discarded.\r\n\r\n## Getting Started\r\n\r\nThe following guide will help you install and use this plugin with Day.js\r\n\r\n### Prerequisites\r\n\r\nDay.js installed\r\n\r\n### Installation\r\n\r\nYou can install via Yarn or npm\r\n\r\n```bash\r\nyarn add dayjs-recur\r\n```\r\n\r\n```bash\r\nnpm install dayjs-recur\r\n```\r\n\r\n## Usage Guide\r\n\r\nYou will need to import the plugin and activate it via the Day.js `.extend()` function\r\n\r\n### ES6\r\n\r\n```javascript\r\nimport dayjs from 'dayjs'\r\nimport dayjsRecur from 'dayjs-recur'\r\n\r\ndayjs.extend(dayjsRecur)\r\n```\r\n\r\n### Node\r\n\r\n```javascript\r\nconst dayjs = require('dayjs')\r\nconst dayjsRecur = require('dayjs-recur')\r\n\r\ndayjs.extend(dayjsRecur)\r\n```\r\n\r\n### Creating a Recurring Date\r\n\r\nYou can create a recurrence from an instance of dayjs or from the constructor a few different ways.\r\n\r\n#### From an instance\r\n\r\n```javascript \r\n// Create a recurrence using today as the start date.\r\nconst recurrence = dayjs().recur();\r\n \r\n// Create a recurrence while passing the start and end dates to the recur function.\r\n// Note: passing an end date requires you to also pass a start date.\r\nconst recurrence = dayjs().recur( start, end );\r\n \r\n// You may pass a start date to the instance of dayjs, or use an existing dayjs instance, to set the start date.\r\n// In this case, passing a date to the recur function sets and end date.\r\nconst recurrence = dayjs(start).recur( end );\r\n \r\n// Finally, you can create a recurrence and pass in an entire set of options.\r\nrecurrence = dayjs().recur({\r\n    start: \"01/01/2020\",\r\n    end: \"01/01/2021\"\r\n});\r\n```\r\n\r\n#### From the constructor\r\n\r\n```javascript  \r\n// Create recurrence without a start date. Note: this will not work with intervals.\r\nconst recurrence = dayjs.recur();\r\n \r\n// Create a recurrence, passing just the start, or the start and end dates.\r\nconst recurrence = dayjs.recur( start, end );\r\n \r\n// Create a recurrence, passing set of options.\r\nconst recurrence = dayjs.recur({\r\n    start: \"01/01/2020\",\r\n    end: \"01/01/2021\"\r\n});\r\n```\r\n\r\n### Creating Rules\r\n\r\ndayjs-recur uses rules to define when a date should recur. You can then generate future or past recurrences based on these rules, or see if a specific date matches the rules. Rules can also be overridden or removed.\r\n\r\n#### The every() Function\r\nThe `every()` function allows you to set the units and, optionally, the measurment type of the recurring date. It returns the recur object to allow chaining.\r\n\r\n```js\r\n// Create a date to start from\r\nconst myDate = dayjs(\"01/01/2020\");\r\n\r\n// You can pass the units to recur on, and the measurement type.\r\nconst recurrence = myDate.recur().every(1, \"days\");\r\n\r\n// You can also chain the measurement type instead of passing it to every.\r\nconst recurrence = myDate.recur().every(1).day();\r\n\r\n// It is also possible to pass an array of units.\r\nconst recurrence = myDate.recur().every([3, 5]).days();\r\n\r\n// When using the dayOfWeek measurement, you can pass days names.\r\nconst recurrence = myDate.recur().every([\"Monday\", \"wed\"]).daysOfWeek();\r\n\r\n// Month names also work when using monthOfYear.\r\nconst recurrence = myDate.recur().every([\"Jan\", \"february\"], \"monthsOfYear\");\r\n```\r\n\r\n`every()` will override the last \"every\" if a measurement was not provided. The following line will create a recurrence for every 5 days.\r\n```js\r\nconst recurrence  = myDate.recur().every(1).every(5).days();\r\n```\r\nIf you need to specify multiple units, pass an array to `every()`.\r\n\r\nYou may also pass the units directly to the interval functions (listed below) instead of using `every()`.\r\n```js\r\nconst recurrence = dayjs.recur().monthOfYear(\"January\");\r\n```\r\n\r\n#### Length Intervals\r\ndayjs-recur supports intervals for days, weeks, months, and years. Measurements may be singular or plural (ex: `day()` vs `days()`). Length Intervals **must** have a start date defined.\r\n\r\nPossible Length Intervals Include:\r\n* day / days\r\n* week / weeks\r\n* month / months\r\n* year / years\r\n\r\n##### Examples\r\n```js\r\n// Create a date to start from\r\nconst myDate = dayjs(\"01/01/2020\");\r\n\r\n// A daily interval - will match every day.\r\nconst interval = myDate.recur().every(1).day();\r\n\r\n// A bi-weekly interval - will match any date that is exactly 2 weeks from myDate.\r\nconst interval = myDate.recur().every(2).weeks();\r\n\r\n// A quarterly interval - will match any date that is exactly 3 months from myDate.\r\nconst interval = myDate.recur().every(3).months();\r\n\r\n// A yearly interval - will match any date that is exactly 1 year from myDate.\r\nconst interval = myDate.recur().every(1).years();\r\n\r\n// It is possible to match multiple units of a single measure using an array.\r\nconst interval = myDate.recur().every([3, 5]).days();\r\n\r\n// It is NOT possible to create compound intervals. The following will never match.\r\nconst interval = myDate.recur().every(3).days().every(2).months(); // Won't work\r\n```\r\n\r\n\r\n#### Calendar Intervals\r\nCalendar Intervals do not depend on a start date. They define a unit of another unit. For instance, a day of a month, or a month of a year. Measurements may be singular or plural (ex: `dayOfMonth()` vs `daysOfMonth()`).\r\n\r\nPossible Calendar Intervals Include:\r\n* dayOfWeek / daysOfWeek\r\n* dayOfMonth / daysOfMonth\r\n* weekOfMonth / weeksOfMonth\r\n* weekOfYear / weeksOfYear\r\n* monthOfYear / monthsOfYear\r\n\r\n##### Examples\r\n```js\r\n// Will match any date that is on Sunday or Monday.\r\nconst cal = dayjs.recur().every([\"Sunday\", 1]).daysOfWeek();\r\n\r\n// Will match any date that is the first or tenth day of any month.\r\nconst cal = dayjs.recur().every([1, 10]).daysOfMonth();\r\n\r\n// Will match any date that is in the first or third week of any month.\r\nconst cal = dayjs.recur().every([1, 3]).weeksOfMonth();\r\n\r\n// Will match any date that is in the 20th week of any year.\r\nconst cal = dayjs.recur().every(20).weekOfYear();\r\n\r\n// Will match any date that is in January of any year.\r\nconst cal = dayjs.recur().every(\"January\").monthsOfYear();\r\n\r\n// You can also combine these rules to match specific dates.\r\n// For instance, this will match only on Valentines day\r\nconst valentines = dayjs.recur().every(14).daysOfMonth()\r\n                               .every(\"Februray\").monthsOfYear();\r\n\r\n// A weekOfMonthByDay interval is available for combining with\r\n// the daysOfWeek to achieve \"nth weekday of month\" recurrences.\r\n// The following matches every 1st and 3rd Thursday of the month.\r\n// (Note this cannot be combined at the dayjs with every(x).months() expression) \r\nconst cal = dayjs.recur().every(\"Thursday\").daysOfWeek()\r\n                    .every([0, 2]).weeksOfMonthByDay();\r\n\r\nconst cal = dayjs.recur().every(dayjs(\"01/01/2020\").day()).daysOfWeek()\r\n                    .every(dayjs(\"01/01/2020\").monthWeekByDay()).weeksOfMonthByDay();\r\n\r\n```\r\n\r\n### Using the Rules\r\n#### Matching\r\nThe `matches()` function will test a date to check if all of the recurrence rules match. It returns `true` if the date matches, `false` otherwise.\r\n```js\r\nconst interval = dayjs(\"01/01/2020\").recur().every(2).days();\r\ninterval.matches(\"01/03/2020\"); // false\r\ninterval.matches(\"01/03/2020\"); // true\r\n```\r\n\r\nYou may also see if a date matches before the start date or after the end date by passing `true` as the second argument to `matches()`.\r\n```js\r\nconst interval = dayjs(\"01/01/2020\").recur().every(2).days();\r\ninterval.matches(\"12/30/2019\"); // false\r\ninterval.matches(\"12/30/2019\", true); // true\r\n```\r\n\r\n#### Exceptions\r\nTo prevent a date from matching that would normally match, use the `except()` function.\r\n\r\n```js\r\nconst recurrence = dayjs(\"01/01/2020\").recur().every(1).day().except(\"01/02/2020\");\r\nrecurrence.matches(\"01/02/2020\"); // false\r\n```\r\n\r\n\r\n#### Overriding and Forgetting\r\nIf a rule is created with the same measurement of a previous rule, it will override the previous rule. Rules can also be removed from a recurrence.\r\n\r\n```js\r\n// Create a recurrence that matches every day, with an exception\r\nconst recurrence = dayjs(\"01/01/2020\").recur().every(1).day().except(\"01/03/2020\");\r\n\r\n// This will override the previous rule and match every 2 days instead.\r\nrecurrence.every(2).days();\r\n\r\n// Exceptions can also be removed by passing a date to the forget() function.\r\nrecurrence.forget(\"01/03/2020\");\r\n\r\n// Rules can be removed by passing the measurement to the forget() function.\r\nrecurrence.forget(\"days\");\r\n```\r\n\r\n\r\n#### Generating Dates\r\nIt is also possible to generate dates from the rules. These functions require a starting date.\r\n\r\n```js\r\n let nextDates;\r\n\r\n// Create a recurrence\r\nconst recurrence = dayjs(\"01/01/2020\").recur().every(2).days();\r\n\r\n// Generate the next three dates as dayjs instances\r\n// Outputs: [dayjs(\"01/03/2020\"), dayjs(\"01/05/2020\"), dayjs(\"01/07/2020\")]\r\nnextDates = recurrence.next(3); \r\n\r\n// Generate the next three dates\r\n// Outputs: [\"01/03/2020\", \"01/05/2020\", \"01/07/2020\"]\r\nnextDates = recurrence.next(3);\r\n\r\n// Generate previous three dates\r\n// Outputs: [\"12/30/2020\", \"12/28/2020\", \"12/26/2020\"]\r\nnextDates = recurrence.previous(3);\r\n```\r\n\r\nIf your recurrence does not have a start date set, or if it does but you want to start at a different date, use the `fromDate()` method first.\r\n```js\r\nconst recurrence = dayjs(\"01/01/2020\").recur().every(2).days();\r\nrecurrence.fromDate(\"02/05/2020\");\r\n\r\n// Outputs: [\"02/06/2020\", \"02/08/2020\", \"02/10/2020\"]\r\nnextDates = recurrence.next(3);\r\n```\r\n\r\nWith both a start date and an end date set, you can generate all dates within that range that match the pattern (including the start/end dates).\r\n```js\r\nconst recurrence = dayjs().recur(\"01/01/2020\", \"01/07/2020\").every(2).days();\r\n\r\n// Outputs: [\"01/01/2020\", \"01/03/2020\", \"01/05/2020\", \"01/07/2020\"]\r\nallDates = recurrence.all();\r\n```\r\n\r\n\r\n**Important Note:** These functions may be very inefficient/slow. They work by attempting to match every date from the start of a range until the desired number of dates have been generated. So if you attempt to get 10 dates for a rule that matches once a year, it will run the match function for ~3650 days.\r\n\r\n\r\n## Local Development and Contributing\r\n\r\nWe are more than happy to accept PRs for bugs, improvements or new features.\r\nDeveloping your own changes locally is easy, you just need to clone the repo\r\n\r\n```bash\r\ngit clone git@github.com/FraserHamilton/dayjs-recur\r\n\r\ncd dayjs-recur\r\n```\r\n\r\nand install the dependencies with either `npm` or `yarn`\r\n\r\n```bash\r\nnpm i\r\n```\r\n\r\n```bash\r\nyarn\r\n```\r\n\r\nTests can be ran with the `test` script\r\n\r\n```bash\r\nnpm run test\r\n```\r\n\r\n```bash\r\nyarn test\r\n```\r\n","readmeFilename":"README.md","homepage":"https://github.com/FraserHamilton/dayjs-recur#readme","bugs":{"url":"https://github.com/FraserHamilton/dayjs-recur/issues"}}