Code and docs

rrule.js demo

This is a demo and test app for rrule.js, a JavaScript library for working with recurrence rules for calendar dates.

Output

rule =
new RRule({
  freq: RRule.WEEKLY,
  count: 30,
  interval: 1
})
rule.origOptions
{
  freq: RRule.WEEKLY,
  count: 30,
  interval: 1
}
rule.toString()
RRULE:FREQ=WEEKLY;COUNT=30;INTERVAL=1;WKST=MO
rule.toText() every week for 30 times
rule.all()
1Sun, 16 Mar 2025 11:17:52 GMT
2Sun, 23 Mar 2025 11:17:52 GMT
3Sun, 30 Mar 2025 11:17:52 GMT
4Sun, 06 Apr 2025 11:17:52 GMT
5Sun, 13 Apr 2025 11:17:52 GMT
6Sun, 20 Apr 2025 11:17:52 GMT
7Sun, 27 Apr 2025 11:17:52 GMT
8Sun, 04 May 2025 11:17:52 GMT
9Sun, 11 May 2025 11:17:52 GMT
10Sun, 18 May 2025 11:17:52 GMT
11Sun, 25 May 2025 11:17:52 GMT
12Sun, 01 Jun 2025 11:17:52 GMT
13Sun, 08 Jun 2025 11:17:52 GMT
14Sun, 15 Jun 2025 11:17:52 GMT
15Sun, 22 Jun 2025 11:17:52 GMT
16Sun, 29 Jun 2025 11:17:52 GMT
17Sun, 06 Jul 2025 11:17:52 GMT
18Sun, 13 Jul 2025 11:17:52 GMT
19Sun, 20 Jul 2025 11:17:52 GMT
20Sun, 27 Jul 2025 11:17:52 GMT
21Sun, 03 Aug 2025 11:17:52 GMT
22Sun, 10 Aug 2025 11:17:52 GMT
23Sun, 17 Aug 2025 11:17:52 GMT
24Sun, 24 Aug 2025 11:17:52 GMT
25Sun, 31 Aug 2025 11:17:52 GMT
26Sun, 07 Sep 2025 11:17:52 GMT
27Sun, 14 Sep 2025 11:17:52 GMT
28Sun, 21 Sep 2025 11:17:52 GMT
29Sun, 28 Sep 2025 11:17:52 GMT
30Sun, 05 Oct 2025 11:17:52 GMT

Input

Options

freq
Frequency
dtstart
The recurrence start. Besides being the base for the recurrence, missing parameters in the final recurrence instances will also be extracted from this date. If not given, new Date will be used instead.
tzid
The timezone for the rule. If present, all recurrences will be interpreted as being in the local time of the given timezone. If not present, UTC will be used instead.
until
If given, this must be a Date instance, that will specify the limit of the recurrence. If a recurrence instance happens to be the same as the Date instance given in the until argument, this will be the last occurrence.
count
How many occurrences will be generated.
interval
The interval between each freq iteration. For example, when using RRule.YEARLY, an interval of 2 means once every two years, but with RRule.HOURLY, it means once every two hours. The default interval is 1.
wkst
The week start day. Must be one of the RRule.MO, RRule.TU, RRule.WE constants, or an integer, specifying the first day of the week. This will affect recurrences based on weekly periods. The default week start is RRule.MO.
byweekday
If given, it must be either an integer ( 0 == RRule.MO), a sequence of integers, one of the weekday constants ( RRule.MO, RRule.TU, etc), or a sequence of these constants. When given, these variables will define the weekdays where the recurrence will be applied. It's also possible to use an argument n for the weekday instances, which will mean the nth occurrence of this weekday in the period. For example, with RRule.MONTHLY, or with RRule.YEARLY and BYMONTH, using RRule.FR.clone(+1) in byweekday will specify the first friday of the month where the recurrence happens. Notice that the RFC documentation, this is specified as BYDAY, but was renamed to avoid the ambiguity of that argument.
bymonth
If given, it must be either an integer, or a sequence of integers, meaning the months to apply the recurrence to.
bysetpos
If given, it must be either an integer, or a sequence of integers, positive or negative. Each given integer will specify an occurrence number, corresponding to the nth occurrence of the rule inside the frequency period. For example, a bysetpos of -1 if combined with a RRule.MONTHLY frequency, and a byweekday of ( RRule.MO, RRule.TU, RRule.WE, RRule.TH, RRule.FR), will result in the last work day of every month.
bymonthday
If given, it must be either an integer, or a sequence of integers, meaning the month days to apply the recurrence to.
byyearday
If given, it must be either an integer, or a sequence of integers, meaning the year days to apply the recurrence to.
byweekno
If given, it must be either an integer, or a sequence of integers, meaning the week numbers to apply the recurrence to. Week numbers have the meaning described in ISO8601, that is, the first week of the year is that containing at least four days of the new year.
byhour
If given, it must be either an integer, or a sequence of integers, meaning the hours to apply the recurrence to.
byminute
If given, it must be either an integer, or a sequence of integers, meaning the minutes to apply the recurrence to.
bysecond
If given, it must be either an integer, or a sequence of integers, meaning the seconds to apply the recurrence to.
byeaster
This is an extension to the RFC specification which the Python implementation provides. Not implemented in the JavaScript version.
Fork me on GitHub