Processor breaking when doing recurrence with the iterator
- Dominant language
- JavaScript
- Stars
- 1.2k
- Forks
- 156
- Avg merge
- 4d 43m
- Merged PRs (30d)
- 3
Description
I have a use case where the processor is breaking and throwing an error when it really should allow processing to continue. With this VEVENT, it is failing on [line 372 of recur_iterator.js](https://github.com/mozilla-comm/ical.js/blob/master/lib/ical/recur_iterator.js#L372) in the check for if the previous date is the same as this one. There's a TODO there saying `// TODO is this valid?` and no, I'd say it's not.
Anyway, the event data that it's breaking on is this:
```
BEGIN:VEVENT
UID:1234@blah.com
CREATED:20180607T162325Z
DTSTAMP:20180803T180000Z
DTSTART;TZID=America/Phoenix:20180803T180000
DTEND;TZID=America/Phoenix:20190104T210000
DESCRIPTION:This test event will break the recurrence iterator.
SUMMARY:FIRST FRIDAY
RRULE:FREQ=WEEKLY;BYDAY=1FR;UNTIL=20190104T210000
END:VEVENT
```
What happens is that the processor hits the DTSTART, records that date and time for the event, then hits the RRULE and notes that it's supposed to repeat the event every first Friday. However, because the RRULE is also specified for weekly, it ignores the "first" part and does every Friday instead.
So the output of the ical is technically wrong since it should be monthly instead of weekly. But the weekly should also be able to see that it's the 1st Friday instead of just every Friday and still do the correct iterations.
Also, instead of erroring out right away for a repeated event, I'd recommend adding a counter to check how many times a date/time has been repeated and if it's more than say, 5, THEN error out.
Contributor guide
Research direction
Start in lib/ical/recur_iterator.js at line 372 and reproduce the failure with the supplied VEVENT. Trace how FREQ=WEEKLY;BYDAY=1FR is interpreted and how repeated dates trigger the error. Done means the recurrence produces the correct first-Friday iterations without stopping immediately on a repeated date.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- data
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100