{"id":13503337,"url":"https://github.com/jkbrzt/rrule","last_synced_at":"2026-01-11T13:28:42.474Z","repository":{"id":4299001,"uuid":"5430389","full_name":"jkbrzt/rrule","owner":"jkbrzt","description":"JavaScript library for working with recurrence rules for calendar dates as defined in the iCalendar RFC and more.","archived":false,"fork":false,"pushed_at":"2024-06-27T17:52:15.000Z","size":4601,"stargazers_count":3493,"open_issues_count":204,"forks_count":534,"subscribers_count":60,"default_branch":"master","last_synced_at":"2025-05-09T10:53:19.769Z","etag":null,"topics":["calendar","icalendar-rfc","jakubroztocil","javascript","library","python-dateutil","recurrence-rules","rfc","rrule","typescript"],"latest_commit_sha":null,"homepage":"https://jkbrzt.github.io/rrule","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jkbrzt.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":["jakubroztocil","davidgoli"]}},"created_at":"2012-08-15T19:14:02.000Z","updated_at":"2025-05-09T10:18:22.000Z","dependencies_parsed_at":"2022-07-11T05:46:11.704Z","dependency_job_id":"e6d2ab41-a12a-4248-90ce-8968403499cf","html_url":"https://github.com/jkbrzt/rrule","commit_stats":{"total_commits":576,"total_committers":77,"mean_commits":7.48051948051948,"dds":0.5868055555555556,"last_synced_commit":"9f2061febeeb363d03352efe33d30c33073a0242"},"previous_names":["jkbrzt/rrule","jkbr/rrule","jakubroztocil/rrule"],"tags_count":34,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jkbrzt%2Frrule","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jkbrzt%2Frrule/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jkbrzt%2Frrule/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jkbrzt%2Frrule/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jkbrzt","download_url":"https://codeload.github.com/jkbrzt/rrule/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253504961,"owners_count":21918884,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["calendar","icalendar-rfc","jakubroztocil","javascript","library","python-dateutil","recurrence-rules","rfc","rrule","typescript"],"created_at":"2024-07-31T22:02:47.311Z","updated_at":"2025-12-18T01:30:26.800Z","avatar_url":"https://github.com/jkbrzt.png","language":"TypeScript","funding_links":["https://github.com/sponsors/jakubroztocil","https://github.com/sponsors/davidgoli"],"categories":["TypeScript","Stale"],"sub_categories":["JS Libraries \u0026 Utilities"],"readme":"# rrule.js\n\n**Library for working with recurrence rules for calendar dates.**\n\n[![NPM version][npm-image]][npm-url]\n[![Build Status][ci-image]][ci-url]\n[![js-standard-style][js-standard-image]][js-standard-url]\n[![Downloads][downloads-image]][downloads-url]\n[![Gitter][gitter-image]][gitter-url]\n[![codecov.io](http://codecov.io/github/jkbrzt/rrule/coverage.svg?branch=master)](http://codecov.io/github/jkbrzt/rrule?branch=master)\n\nrrule.js supports recurrence rules as defined in the [iCalendar\nRFC](https://tools.ietf.org/html/rfc5545), with a few important\n[differences](#differences-from-icalendar-rfc). It is a partial port of the\n`rrule` module from the excellent\n[python-dateutil](http://labix.org/python-dateutil/) library. On top of\nthat, it supports parsing and serialization of recurrence rules from and\nto natural language.\n\n---\n\n### Quick Start\n\n- [Demo app](http://jkbrzt.github.io/rrule/)\n- # For contributors and maintainers: the code for the demo app is only on `gh-pages` branch\n\n#### Client Side\n\n```bash\n$ yarn add rrule\n```\n\n#### Server Side\n\nIncludes optional TypeScript types\n\n```bash\n$ yarn add rrule\n# or\n$ npm install rrule\n```\n\n#### Usage\n\n**RRule:**\n\n```es6\nimport { datetime, RRule, RRuleSet, rrulestr } from 'rrule'\n\n// Create a rule:\nconst rule = new RRule({\n  freq: RRule.WEEKLY,\n  interval: 5,\n  byweekday: [RRule.MO, RRule.FR],\n  dtstart: datetime(2012, 2, 1, 10, 30),\n  until: datetime(2012, 12, 31)\n})\n\n// Get all occurrence dates (Date instances):\nrule.all()\n[ '2012-02-03T10:30:00.000Z',\n  '2012-03-05T10:30:00.000Z',\n  '2012-03-09T10:30:00.000Z',\n  '2012-04-09T10:30:00.000Z',\n  '2012-04-13T10:30:00.000Z',\n  '2012-05-14T10:30:00.000Z',\n  '2012-05-18T10:30:00.000Z',\n\n /* … */]\n\n// Get a slice:\nrule.between(datetime(2012, 8, 1), datetime(2012, 9, 1))\n['2012-08-27T10:30:00.000Z',\n '2012-08-31T10:30:00.000Z']\n\n// Get an iCalendar RRULE string representation:\n// The output can be used with RRule.fromString().\nrule.toString()\n\"DTSTART:20120201T093000Z\\nRRULE:FREQ=WEEKLY;INTERVAL=5;UNTIL=20130130T230000Z;BYDAY=MO,FR\"\n\n// Get a human-friendly text representation:\n// The output can be used with RRule.fromText().\nrule.toText()\n\"every 5 weeks on Monday, Friday until January 31, 2013\"\n```\n\n**RRuleSet:**\n\n```js\nconst rruleSet = new RRuleSet()\n\n// Add a rrule to rruleSet\nrruleSet.rrule(\n  new RRule({\n    freq: RRule.MONTHLY,\n    count: 5,\n    dtstart: datetime(2012, 2, 1, 10, 30),\n  })\n)\n\n// Add a date to rruleSet\nrruleSet.rdate(datetime(2012, 7, 1, 10, 30))\n\n// Add another date to rruleSet\nrruleSet.rdate(datetime(2012, 7, 2, 10, 30))\n\n// Add a exclusion rrule to rruleSet\nrruleSet.exrule(\n  new RRule({\n    freq: RRule.MONTHLY,\n    count: 2,\n    dtstart: datetime(2012, 3, 1, 10, 30),\n  })\n)\n\n// Add a exclusion date to rruleSet\nrruleSet.exdate(datetime(2012, 5, 1, 10, 30))\n\n// Get all occurrence dates (Date instances):\nrruleSet.all()[\n  ('2012-02-01T10:30:00.000Z',\n  '2012-05-01T10:30:00.000Z',\n  '2012-07-01T10:30:00.000Z',\n  '2012-07-02T10:30:00.000Z')\n]\n\n// Get a slice:\nrruleSet.between(datetime(2012, 2, 1), datetime(2012, 6, 2))[\n  ('2012-05-01T10:30:00.000Z', '2012-07-01T10:30:00.000Z')\n]\n\n// To string\nrruleSet.valueOf()[\n  ('DTSTART:20120201T023000Z',\n  'RRULE:FREQ=MONTHLY;COUNT=5',\n  'RDATE:20120701T023000Z,20120702T023000Z',\n  'EXRULE:FREQ=MONTHLY;COUNT=2',\n  'EXDATE:20120601T023000Z')\n]\n\n// To string\nrruleSet.toString()\n;('[\"DTSTART:20120201T023000Z\",\"RRULE:FREQ=MONTHLY;COUNT=5\",\"RDATE:20120701T023000Z,20120702T023000Z\",\"EXRULE:FREQ=MONTHLY;COUNT=2\",\"EXDATE:20120601T023000Z\"]')\n```\n\n**rrulestr:**\n\n```js\n// Parse a RRule string, return a RRule object\nrrulestr('DTSTART:20120201T023000Z\\nRRULE:FREQ=MONTHLY;COUNT=5')\n\n// Parse a RRule string, return a RRuleSet object\nrrulestr('DTSTART:20120201T023000Z\\nRRULE:FREQ=MONTHLY;COUNT=5', {\n  forceset: true,\n})\n\n// Parse a RRuleSet string, return a RRuleSet object\nrrulestr(\n  'DTSTART:20120201T023000Z\\nRRULE:FREQ=MONTHLY;COUNT=5\\nRDATE:20120701T023000Z,20120702T023000Z\\nEXRULE:FREQ=MONTHLY;COUNT=2\\nEXDATE:20120601T023000Z'\n)\n```\n\n### Important: Use UTC dates\n\nDates in JavaScript are tricky. `RRule` tries to support as much flexibility as possible without adding any large required 3rd party dependencies, but that means we also have some special rules.\n\nBy default, `RRule` deals in [\"floating\" times or UTC timezones](https://tools.ietf.org/html/rfc5545#section-3.2.19). If you want results in a specific timezone, `RRule` also provides [timezone support](#timezone-support). Either way, JavaScript's built-in \"timezone\" offset tends to just get in the way, so this library simply doesn't use it at all. All times are returned with zero offset, as though it didn't exist in JavaScript.\n\n**THE BOTTOM LINE: Returned \"UTC\" dates are always meant to be interpreted as dates in your local timezone. This may mean you have to do additional conversion to get the \"correct\" local time with offset applied.**\n\nFor this reason, it is highly recommended to use timestamps in UTC eg. `new Date(Date.UTC(...))`. Returned dates will likewise be in UTC (except on Chrome, which always returns dates with a timezone offset). It's recommended to use the provided `datetime()` helper, which\ncreates dates in the correct format using a 1-based month.\n\nFor example:\n\n```ts\n// local machine zone is America/Los_Angeles\nconst rule = RRule.fromString(\n  \"DTSTART;TZID=America/Denver:20181101T190000;\\n\"\n  + \"RRULE:FREQ=WEEKLY;BYDAY=MO,WE,TH;INTERVAL=1;COUNT=3\"\n)\nrule.all()\n\n[ 2018-11-01T18:00:00.000Z,\n  2018-11-05T18:00:00.000Z,\n  2018-11-07T18:00:00.000Z ]\n// Even though the given offset is `Z` (UTC), these are local times, not UTC times.\n// Each of these this is the correct local Pacific time of each recurrence in\n// America/Los_Angeles when it is 19:00 in America/Denver, including the DST shift.\n\n// You can get the local components by using the getUTC* methods eg:\ndate.getUTCDate() // --\u003e 1\ndate.getUTCHours() // --\u003e 18\n```\n\nIf you want to get the same times in true UTC, you may do so (e.g., using [Luxon](https://moment.github.io/luxon/#/)):\n\n```ts\nrule.all().map(date =\u003e\nDateTime.fromJSDate(date)\n  .toUTC()\n  .setZone('local', { keepLocalTime: true })\n  .toJSDate()\n)\n\n[ 2018-11-02T01:00:00.000Z,\n  2018-11-06T02:00:00.000Z,\n  2018-11-08T02:00:00.000Z ]\n// These times are in true UTC; you can see the hours shift\n```\n\nFor more examples see\n[python-dateutil](http://labix.org/python-dateutil/) documentation.\n\n---\n\n### Timezone Support\n\nRrule also supports use of the `TZID` parameter in the\n[RFC](https://tools.ietf.org/html/rfc5545#section-3.2.19) using the\n[Intl API](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl).\nSupport matrix for the Intl API applies. If you need to support additional environments,\nplease consider using a [polyfill](https://formatjs.io/docs/polyfills/).\n\nExample with `TZID`:\n\n```js\nnew RRule({\n  dtstart: datetime(2018, 2, 1, 10, 30),\n  count: 1,\n  tzid: 'Asia/Tokyo',\n}).all()[\n  // assuming the system timezone is set to America/Los_Angeles, you get:\n  '2018-01-31T17:30:00.000Z'\n]\n// which is the time in Los Angeles when it's 2018-02-01T10:30:00 in Tokyo.\n```\n\nWhether or not you use the `TZID` param, make sure to only use JS `Date` objects that are\nrepresented in UTC to avoid unexpected timezone offsets being applied, for example:\n\n```js\n// WRONG: Will produce dates with TZ offsets added\nnew RRule({\n  freq: RRule.MONTHLY,\n  dtstart: new Date(2018, 1, 1, 10, 30),\n  until: new Date(2018, 2, 31),\n}).all()[('2018-02-01T18:30:00.000Z', '2018-03-01T18:30:00.000Z')]\n\n// RIGHT: Will produce dates with recurrences at the correct time\nnew RRule({\n  freq: RRule.MONTHLY,\n  dtstart: datetime(2018, 2, 1, 10, 30),\n  until: datetime(2018, 3, 31),\n}).all()[('2018-02-01T10:30:00.000Z', '2018-03-01T10:30:00.000Z')]\n```\n\n### API\n\n#### `RRule` Constructor\n\n```javascript\nnew RRule(options[, noCache=false])\n```\n\nThe `options` argument mostly corresponds to the properties defined for `RRULE` in the\niCalendar RFC. Only `freq` is required.\n\n\u003ctable\u003e\n    \u003c!-- why, markdown... --\u003e\n    \u003cthead\u003e\n    \u003ctr\u003e\n        \u003cth\u003eOption\u003c/th\u003e\n        \u003cth\u003eDescription\u003c/th\u003e\n    \u003c/tr\u003e\n    \u003c/thead\u003e\n    \u003ctbody\u003e\n    \u003ctr\u003e\n        \u003ctd\u003e\u003ccode\u003efreq\u003c/code\u003e\u003c/td\u003e\n        \u003ctd\u003e\n            \u003cp\u003e(required) One of the following constants:\u003c/p\u003e\n            \u003cul\u003e\n                \u003cli\u003e\u003ccode\u003eRRule.YEARLY\u003c/code\u003e\u003c/li\u003e\n                \u003cli\u003e\u003ccode\u003eRRule.MONTHLY\u003c/code\u003e\u003c/li\u003e\n                \u003cli\u003e\u003ccode\u003eRRule.WEEKLY\u003c/code\u003e\u003c/li\u003e\n                \u003cli\u003e\u003ccode\u003eRRule.DAILY\u003c/code\u003e\u003c/li\u003e\n                \u003cli\u003e\u003ccode\u003eRRule.HOURLY\u003c/code\u003e\u003c/li\u003e\n                \u003cli\u003e\u003ccode\u003eRRule.MINUTELY\u003c/code\u003e\u003c/li\u003e\n                \u003cli\u003e\u003ccode\u003eRRule.SECONDLY\u003c/code\u003e\u003c/li\u003e\n            \u003c/ul\u003e\n        \u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n        \u003ctd\u003e\u003ccode\u003edtstart\u003c/code\u003e\u003c/td\u003e\n        \u003ctd\u003eThe recurrence start. Besides being the base for the\n            recurrence, missing parameters in the final recurrence\n            instances will also be extracted from this date. If not\n            given, \u003ccode\u003enew Date\u003c/code\u003e will be used instead.\n            **IMPORTANT:** See the discussion under \u003ca href=\"#timezone-support\"\u003etimezone support\u003c/a\u003e\n        \u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n        \u003ctd\u003e\u003ccode\u003einterval\u003c/code\u003e\u003c/td\u003e\n        \u003ctd\u003eThe interval between each freq iteration. For example,\n            when using \u003ccode\u003eRRule.YEARLY\u003c/code\u003e, an interval of \u003ccode\u003e2\u003c/code\u003e means\n            once every\n            two years, but with \u003ccode\u003eRRule.HOURLY\u003c/code\u003e, it means once every two\n            hours.\n            The default interval is \u003ccode\u003e1\u003c/code\u003e.\n        \u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n        \u003ctd\u003e\u003ccode\u003ewkst\u003c/code\u003e\u003c/td\u003e\n        \u003ctd\u003eThe week start day. Must be one of the \u003ccode\u003eRRule.MO\u003c/code\u003e,\n            \u003ccode\u003eRRule.TU\u003c/code\u003e, \u003ccode\u003eRRule.WE\u003c/code\u003e constants, or an integer,\n            specifying\n            the first day of the week. This will affect recurrences based\n            on weekly periods. The default week start is \u003ccode\u003eRRule.MO\u003c/code\u003e.\n        \u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n        \u003ctd\u003e\u003ccode\u003ecount\u003c/code\u003e\u003c/td\u003e\n        \u003ctd\u003eHow many occurrences will be generated.\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n        \u003ctd\u003e\u003ccode\u003euntil\u003c/code\u003e\u003c/td\u003e\n        \u003ctd\u003eIf given, this must be a \u003ccode\u003eDate\u003c/code\u003e instance, that will specify\n            the limit of the recurrence. If a recurrence instance happens\n            to be the same as the \u003ccode\u003eDate\u003c/code\u003e instance given in the\n            \u003ccode\u003euntil\u003c/code\u003e\n            argument, this will be the last occurrence.\n        \u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd\u003e\u003ccode\u003etzid\u003c/code\u003e\u003c/td\u003e\n      \u003ctd\u003eIf given, this must be a IANA string recognized by the Intl API. See\n      discussion under \u003ca href=\"#timezone-support\"\u003eTimezone support\u003c/a\u003e.\n      \u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n        \u003ctd\u003e\u003ccode\u003ebysetpos\u003c/code\u003e\u003c/td\u003e\n        \u003ctd\u003eIf given, it must be either an integer, or an array of\n            integers, positive or negative. Each given integer will specify\n            an occurrence number, corresponding to the nth occurrence of\n            the rule inside the frequency period. For example, a\n            \u003ccode\u003ebysetpos\u003c/code\u003e of \u003ccode\u003e-1\u003c/code\u003e if combined with a \u003ccode\u003eRRule.MONTHLY\u003c/code\u003e\n            frequency, and a byweekday of (\u003ccode\u003eRRule.MO\u003c/code\u003e, \u003ccode\u003eRRule.TU\u003c/code\u003e,\n            \u003ccode\u003eRRule.WE\u003c/code\u003e, \u003ccode\u003eRRule.TH\u003c/code\u003e, \u003ccode\u003eRRule.FR\u003c/code\u003e), will result in\n            the last\n            work day of every month.\n        \u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n        \u003ctd\u003e\u003ccode\u003ebymonth\u003c/code\u003e\u003c/td\u003e\n        \u003ctd\u003eIf given, it must be either an integer, or an array of\n            integers, meaning the months to apply the recurrence to.\n        \u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n        \u003ctd\u003e\u003ccode\u003ebymonthday\u003c/code\u003e\u003c/td\u003e\n        \u003ctd\u003eIf given, it must be either an integer, or an array of\n            integers, meaning the month days to apply the recurrence to.\n        \u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n        \u003ctd\u003e\u003ccode\u003ebyyearday\u003c/code\u003e\u003c/td\u003e\n        \u003ctd\u003eIf given, it must be either an integer, or an array of\n            integers, meaning the year days to apply the recurrence to.\n        \u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n        \u003ctd\u003e\u003ccode\u003ebyweekno\u003c/code\u003e\u003c/td\u003e\n        \u003ctd\u003eIf given, it must be either an integer, or an array of\n            integers, meaning the week numbers to apply the recurrence to.\n            Week numbers have the meaning described in ISO8601, that is,\n            the first week of the year is that containing at least four\n            days of the new year.\n        \u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n        \u003ctd\u003e\u003ccode\u003ebyweekday\u003c/code\u003e\u003c/td\u003e\n        \u003ctd\u003eIf given, it must be either an integer (\u003ccode\u003e0 == RRule.MO\u003c/code\u003e), an\n            array of integers, one of the weekday constants\n            (\u003ccode\u003eRRule.MO\u003c/code\u003e,\n            \u003ccode\u003eRRule.TU\u003c/code\u003e, etc), or an array of these constants. When\n            given,\n            these variables will define the weekdays where the recurrence\n            will be applied. It's also possible to use an argument n for\n            the weekday instances, which will mean the nth occurrence of\n            this weekday in the period. For example, with\n            \u003ccode\u003eRRule.MONTHLY\u003c/code\u003e,\n            or with \u003ccode\u003eRRule.YEARLY\u003c/code\u003e and \u003ccode\u003eBYMONTH\u003c/code\u003e, using\n            \u003ccode\u003eRRule.FR.nth(+1)\u003c/code\u003e or \u003ccode\u003eRRule.FR.nth(-1)\u003c/code\u003e in \u003ccode\u003ebyweekday\u003c/code\u003e\n            will specify the first or last friday of the month where the\n            recurrence happens.\n            Notice\n            that the RFC documentation, this is specified as \u003ccode\u003eBYDAY\u003c/code\u003e,\n            but was renamed to avoid the ambiguity of that argument.\n        \u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n        \u003ctd\u003e\u003ccode\u003ebyhour\u003c/code\u003e\u003c/td\u003e\n        \u003ctd\u003eIf given, it must be either an integer, or an array of\n            integers, meaning the hours to apply the recurrence to.\n        \u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n        \u003ctd\u003e\u003ccode\u003ebyminute\u003c/code\u003e\u003c/td\u003e\n        \u003ctd\u003eIf given, it must be either an integer, or an array of\n            integers, meaning the minutes to apply the recurrence to.\n        \u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n        \u003ctd\u003e\u003ccode\u003ebysecond\u003c/code\u003e\u003c/td\u003e\n        \u003ctd\u003eIf given, it must be either an integer, or an array of\n            integers, meaning the seconds to apply the recurrence to.\n        \u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n        \u003ctd\u003e\u003ccode\u003ebyeaster\u003c/code\u003e\u003c/td\u003e\n        \u003ctd\u003eThis is an extension to the RFC specification which the Python\n            implementation provides.\n            \u003cstrong\u003eNot implemented in the JavaScript version.\u003c/strong\u003e\n        \u003c/td\u003e\n    \u003c/tr\u003e\n    \u003c/tbody\u003e\n\u003c/table\u003e\n\n`noCache`: Set to `true` to disable caching of results. If you will use the\nsame rrule instance multiple times, enabling caching will improve the\nperformance considerably. Enabled by default.\n\nSee also [python-dateutil](http://labix.org/python-dateutil/)\ndocumentation.\n\n---\n\n#### Instance properties\n\n\u003cdl\u003e\n    \u003cdt\u003e\u003ccode\u003erule.options\u003c/code\u003e\u003c/dt\u003e\n    \u003cdd\u003eProcessed options applied to the rule. Includes default options\n    (such us \u003ccode\u003ewkstart\u003c/code\u003e). Currently,\n    \u003ccode\u003erule.options.byweekday\u003c/code\u003e isn't equal\n    to \u003ccode\u003erule.origOptions.byweekday\u003c/code\u003e (which is an inconsistency).\n    \u003c/dd\u003e\n    \u003cdt\u003e\u003ccode\u003erule.origOptions\u003c/code\u003e\u003c/dt\u003e\n    \u003cdd\u003eThe original \u003ccode\u003eoptions\u003c/code\u003e argument passed to\n    the constructor.\u003c/dd\u003e\n\u003c/dl\u003e\n\n---\n\n#### Occurrence Retrieval Methods\n\n##### `RRule.prototype.all([iterator])`\n\nReturns all dates matching the rule. It is a replacement for the\niterator protocol this class implements in the Python version.\n\nAs rules without `until` or `count` represent infinite date series, you\ncan optionally pass `iterator`, which is a function that is called for\neach date matched by the rule. It gets two parameters `date` (the `Date`\ninstance being added), and `i` (zero-indexed position of `date` in the\nresult). Dates are being added to the result as long as the iterator\nreturns `true`. If a `false`-y value is returned, `date` isn't added to\nthe result and the iteration is interrupted (possibly prematurely).\n\n```javascript\nrule.all()[\n  ('2012-02-01T10:30:00.000Z',\n  '2012-05-01T10:30:00.000Z',\n  '2012-07-01T10:30:00.000Z',\n  '2012-07-02T10:30:00.000Z')\n]\n\nrule.all(function (date, i) {\n  return i \u003c 2\n})[('2012-02-01T10:30:00.000Z', '2012-05-01T10:30:00.000Z')]\n```\n\n##### `RRule.prototype.between(after, before, inc=false [, iterator])`\n\nReturns all the occurrences of the rrule between `after` and `before`.\nThe `inc` keyword defines what happens if `after` and/or `before` are\nthemselves occurrences. With `inc == true`, they will be included in the\nlist, if they are found in the recurrence set.\n\nOptional `iterator` has the same function as it has with\n`RRule.prototype.all()`.\n\n```javascript\nrule.between(datetime(2012, 8, 1), datetime(2012, 9, 1))[\n  ('2012-08-27T10:30:00.000Z', '2012-08-31T10:30:00.000Z')\n]\n```\n\n##### `RRule.prototype.before(dt, inc=false)`\n\nReturns the last recurrence before the given `Date` instance. The `inc`\nargument defines what happens if `dt` is an occurrence. With\n`inc == true`, if `dt` itself is an occurrence, it will be returned.\n\n##### `RRule.prototype.after(dt, inc=false)`\n\nReturns the first recurrence\nafter the given `Date` instance. The `inc` argument defines what happens\nif `dt` is an occurrence. With `inc == true`, if `dt` itself is an\noccurrence, it will be returned.\n\nSee also [python-dateutil](http://labix.org/python-dateutil/)\ndocumentation.\n\n---\n\n#### iCalendar RFC String Methods\n\n##### `RRule.prototype.toString()`\n\nReturns a string representation of the rule as per the iCalendar RFC.\nOnly properties explicitly specified in `options` are included:\n\n```javascript\nrule.toString()\n;('DTSTART:20120201T093000Z\\nRRULE:FREQ=WEEKLY;INTERVAL=5;UNTIL=20130130T230000Z;BYDAY=MO,FR')\n\nrule.toString() == RRule.optionsToString(rule.origOptions)\ntrue\n```\n\n##### `RRule.optionsToString(options)`\n\nConverts `options` to iCalendar RFC `RRULE` string:\n\n```javascript\n// Get full a string representation of all options,\n// including the default and inferred ones.\nRRule.optionsToString(rule.options)\n;('DTSTART:20120201T093000Z\\nRRULE:FREQ=WEEKLY;INTERVAL=5;WKST=0;UNTIL=20130130T230000Z;BYDAY=MO,FR;BYHOUR=10;BYMINUTE=30;BYSECOND=0')\n\n// Cherry-pick only some options from an rrule:\nRRule.optionsToString({\n  freq: rule.options.freq,\n  dtstart: rule.options.dtstart,\n})\n;('DTSTART:20120201T093000Z\\nRRULE:FREQ=WEEKLY;')\n```\n\n##### `RRule.fromString(rfcString)`\n\nConstructs an `RRule` instance from a complete `rfcString`:\n\n```javascript\nvar rule = RRule.fromString('DTSTART:20120201T093000Z\\nRRULE:FREQ=WEEKLY;')\n\n// This is equivalent\nvar rule = new RRule(\n  RRule.parseString('DTSTART:20120201T093000Z\\nRRULE:FREQ=WEEKLY')\n)\n```\n\n##### `RRule.parseString(rfcString)`\n\nOnly parse RFC string and return `options`.\n\n```javascript\nvar options = RRule.parseString('FREQ=DAILY;INTERVAL=6')\noptions.dtstart = datetime(2000, 2, 1)\nvar rule = new RRule(options)\n```\n\n---\n\n#### Natural Language Text Methods\n\nThese methods provide an incomplete support for text→`RRule` and\n`RRule`→text conversion. You should test them with your input to see\nwhether the result is acceptable.\n\n##### `RRule.prototype.toText([gettext, [language]])`\n\nReturns a textual representation of `rule`. The `gettext` callback, if\nprovided, will be called for each text token and its return value used\ninstead. The optional `language` argument is a language definition to be\nused (defaults to `rrule/nlp.js:ENGLISH`).\n\n```javascript\nvar rule = new RRule({\n  freq: RRule.WEEKLY,\n  count: 23,\n})\nrule.toText()\n;('every week for 23 times')\n```\n\n##### `RRule.prototype.isFullyConvertibleToText()`\n\nProvides a hint on whether all the options the rule has are convertible\nto text.\n\n##### `RRule.fromText(text[, language])`\n\nConstructs an `RRule` instance from `text`.\n\n```javascript\nrule = RRule.fromText('every day for 3 times')\n```\n\n##### `RRule.parseText(text[, language])`\n\nParse `text` into `options`:\n\n```javascript\noptions = RRule.parseText('every day for 3 times')\n// {freq: 3, count: \"3\"}\noptions.dtstart = datetime(2000, 2, 1)\nvar rule = new RRule(options)\n```\n\n---\n\n#### `RRuleSet` Constructor\n\n```javascript\nnew RRuleSet([(noCache = false)])\n```\n\nThe `RRuleSet` instance allows more complex recurrence setups, mixing multiple\nrules, dates, exclusion rules, and exclusion dates.\n\nDefault `noCache` argument is `false`, caching of results will be enabled,\nimproving performance of multiple queries considerably.\n\n##### `RRuleSet.prototype.rrule(rrule)`\n\nInclude the given `rrule` instance in the recurrence set generation.\n\n##### `RRuleSet.prototype.rdate(dt)`\n\nInclude the given datetime instance `dt` in the recurrence set generation.\n\n##### `RRuleSet.prototype.exrule(rrule)`\n\nInclude the given `rrule` instance in the recurrence set exclusion list. Dates\nwhich are part of the given recurrence rules will not be generated, even if\nsome inclusive rrule or rdate matches them. **NOTE:** `EXRULE` has been (deprecated\nin RFC 5545)[https://icalendar.org/iCalendar-RFC-5545/a-3-deprecated-features.html]\nand does not support a `DTSTART` property.\n\n##### `RRuleSet.prototype.exdate(dt)`\n\nInclude the given datetime instance `dt` in the recurrence set exclusion list. Dates\nincluded that way will not be generated, even if some inclusive `rrule` or\n`rdate` matches them.\n\n##### `RRuleSet.prototype.tzid(tz?)`\n\nSets or overrides the timezone identifier. Useful if there are no rrules in this\n`RRuleSet` and thus no `DTSTART`.\n\n##### `RRuleSet.prototype.all([iterator])`\n\nSame as `RRule.prototype.all`.\n\n##### `RRuleSet.prototype.between(after, before, inc=false [, iterator])`\n\nSame as `RRule.prototype.between`.\n\n##### `RRuleSet.prototype.before(dt, inc=false)`\n\nSame as `RRule.prototype.before`.\n\n##### `RRuleSet.prototype.after(dt, inc=false)`\n\nSame as `RRule.prototype.after`.\n\n##### `RRuleSet.prototype.rrules()`\n\nGet list of included rrules in this recurrence set.\n\n##### `RRuleSet.prototype.exrules()`\n\nGet list of excluded rrules in this recurrence set.\n\n##### `RRuleSet.prototype.rdates()`\n\nGet list of included datetimes in this recurrence set.\n\n##### `RRuleSet.prototype.exdates()`\n\nGet list of excluded datetimes in this recurrence set.\n\n---\n\n#### `rrulestr` Function\n\n```js\nrrulestr(rruleStr[, options])\n```\n\nThe `rrulestr` function is a parser for RFC-like syntaxes. The string passed\nas parameter may be a multiple line string, a single line string, or just the\n`RRULE` property value.\n\nAdditionally, it accepts the following keyword arguments:\n\n\u003cdl\u003e\n\n\u003cdt\u003e\u003ccode\u003ecache\u003c/code\u003e\u003c/dt\u003e\n\u003cdd\u003e\nIf \u003ccode\u003etrue\u003c/code\u003e, the \u003ccode\u003erruleset\u003c/code\u003e or \u003ccode\u003errule\u003c/code\u003e created instance \nwill cache its results.\nDefault is not to cache.\n\u003c/dd\u003e\n\n\u003cdt\u003e\u003ccode\u003edtstart\u003c/code\u003e\u003c/dt\u003e\n\u003cdd\u003e\nIf given, it must be a datetime instance that will be used when no \n\u003ccode\u003eDTSTART\u003c/code\u003e property is found in the parsed string. \nIf it is not given, and the property is not found, \n\u003ccode\u003edatetime.now()\u003c/code\u003e will be used instead.\n\u003c/dd\u003e\n\n\u003cdt\u003e\u003ccode\u003eunfold\u003c/code\u003e\u003c/dt\u003e\n\u003cdd\u003e\nIf set to \u003ccode\u003etrue\u003c/code\u003e, lines will be unfolded following the RFC specification. \nIt defaults to \u003ccode\u003efalse\u003c/code\u003e, meaning that spaces before every line will be stripped.\n\u003c/dd\u003e\n\n\u003cdt\u003e\u003ccode\u003eforceset\u003c/code\u003e\u003c/dt\u003e\n\u003cdd\u003e\nIf set to \u003ccode\u003etrue\u003c/code\u003e, an \u003ccode\u003erruleset\u003c/code\u003e instance will be returned, \neven if only a single rule is found. \nThe default is to return an \u003ccode\u003errule\u003c/code\u003e if possible, and \nan \u003ccode\u003erruleset\u003c/code\u003e if necessary.\n\u003c/dd\u003e\n\n\u003cdt\u003e\u003ccode\u003ecompatible\u003c/code\u003e\u003c/dt\u003e\n\u003cdd\u003e\nIf set to \u003ccode\u003etrue\u003c/code\u003e, the parser will operate in RFC-compatible mode. \nRight now it means that unfold will be turned on, and if a \u003ccode\u003eDTSTART\u003c/code\u003e is found, \nit will be considered the first recurrence instance, as documented in the RFC.\n\u003c/dd\u003e\n\n\u003cdt\u003e\u003ccode\u003etzid\u003c/code\u003e\u003c/dt\u003e\n\u003cdd\u003e\nIf given, it must be a string that will be used when no \u003ccode\u003eTZID\u003c/code\u003e \nproperty is found in the parsed string. \nIf it is not given, and the property is not found, \u003ccode\u003e'UTC'\u003c/code\u003e will \nbe used by default.\n\u003c/dd\u003e\n\n\u003c/dl\u003e\n\n---\n\n### Differences From iCalendar RFC\n\n- `RRule` has no `byday` keyword. The equivalent keyword has been replaced by\n  the `byweekday` keyword, to remove the ambiguity present in the original\n  keyword.\n- Unlike documented in the RFC, the starting datetime, `dtstart`, is\n  not the first recurrence instance, unless it does fit in the specified rules.\n  This is in part due to this project being a port of\n  [python-dateutil](https://labix.org/python-dateutil#head-a65103993a21b717f6702063f3717e6e75b4ba66),\n  which has the same non-compliant functionality. Note that you can get the\n  original behavior by using a `RRuleSet` and adding the `dtstart` as an `rdate`.\n\n```javascript\nvar rruleSet = new RRuleSet()\nvar start = datetime(2012, 2, 1, 10, 30)\n\n// Add a rrule to rruleSet\nrruleSet.rrule(\n  new RRule({\n    freq: RRule.MONTHLY,\n    count: 5,\n    dtstart: start,\n  })\n)\n\n// Add a date to rruleSet\nrruleSet.rdate(start)\n```\n\n- Unlike documented in the RFC, every keyword is valid on every frequency. (The\n  RFC documents that `byweekno` is only valid on yearly frequencies, for example.)\n\n### Development\n\nrrule.js is implemented in Typescript. It uses [JavaScript Standard Style](https://github.com/feross/standard) coding style.\n\nTo run the code, checkout this repository and run:\n\n```\n$ yarn\n```\n\nTo run the tests, run:\n\n```\n$ yarn test\n```\n\nTo build files for distribution, run:\n\n```\n$ yarn build\n```\n\n#### Authors\n\n- [Jakub Roztocil](http://roztocil.co)\n  ([@jkbrzt](http://twitter.com/jkbrzt))\n- Lars Schöning ([@lyschoening](http://twitter.com/lyschoening))\n- David Golightly ([@davigoli](http://twitter.com/davigoli))\n\nPython `dateutil` is written by [Gustavo\nNiemeyer](http://niemeyer.net).\n\nSee [LICENCE](https://github.com/jkbrzt/rrule/blob/master/LICENCE) for\nmore details.\n\n[npm-url]: https://npmjs.org/package/rrule\n[npm-image]: http://img.shields.io/npm/v/rrule.svg\n[ci-url]: https://github.com/jkbrzt/rrule/actions\n[ci-image]: https://github.com/jkbrzt/rrule/workflows/Node%20CI/badge.svg\n[downloads-url]: https://npmjs.org/package/rrule\n[downloads-image]: http://img.shields.io/npm/dm/rrule.svg?style=flat-square\n[js-standard-url]: https://github.com/feross/standard\n[js-standard-image]: https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat\n[gitter-url]: https://gitter.im/rrule-js/Lobby\n[gitter-image]: https://img.shields.io/gitter/room/nwjs/nw.js.svg\n\n#### Related projects\n\n- https://rrules.com — RESTful API to get back occurrences of RRULEs that conform to RFC 5545.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjkbrzt%2Frrule","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjkbrzt%2Frrule","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjkbrzt%2Frrule/lists"}