rossta / montrose

Recurring events library for Ruby. Enumerable recurrence objects and convenient chainable interface.
https://rossta.net/montrose/
MIT License
821 stars 53 forks source link

Adds Montrose ical RRULE parsing #139

Closed rossta closed 3 years ago

rossta commented 3 years ago

This PR adds a long requested feature of parsing ICAL RRULES, as described by RFC 5545, Section 3.8.5.

Example:

ical = <<~ICAL
  DTSTART;TZID=America/New_York:19970922T090000
  RRULE:FREQ=MONTHLY;COUNT=6;BYDAY=-2MO
ICAL

recurrence = Montrose::Recurrence.from_ical(ical)
recurrence.events.to_a
=> [1997-09-22 09:00:00 -0400,
 1997-10-20 09:00:00 -0400,
 1997-11-17 09:00:00 -0500,
 1997-12-22 09:00:00 -0500,
 1998-01-19 09:00:00 -0500,
 1998-02-16 09:00:00 -0500]

Partially addresses #26

This feature is missing support for "WKST", i.e. week start, and "SETPOS", i.e. nth instance of given weekday(s) within a month which will be considered future enhancements.