Right now I’m using google-rfc-2445 library to evaluate recurring events, and generate actual dates, for example to know when will occur event defined by following RRULE: RRULE:FREQ=MONTHLY;BYDAY=MO,TU,WE,TH,FR;BYSETPOS=-1
I’m using biweekly library to generate *.ics files. Actually it does same as iCal4j but API much more easy to use.
I see that both libraries have at some level interchangeable functionality, so my question, can I use single library (iCal4j/biweekly) for both tasks? Generate recurring events and export/import *.ics files?
Advertisement
Answer
google-rfc-2445 focuses primarily on evaluating recurrence rules, while biweekly and iCal4j focus on working with iCalendar files as a whole.
If your goal is to generate iCalendar files, then you should use biweekly or iCal4j. If you need to iterate over the dates that are in a recurrence rule, then use google-rfc-2445. If you just need to create a recurrence rule, you don’t need google-rfc-2445.
biweekly allows you to iterate over the dates in a recurrence rule (see code below). It uses google-rfc-2445 to do this.
ICalendar ical = ... VEvent event = ical.getEvents().get(0); RecurrenceRule rrule = event.getRecurrenceRule(); Iterator<Date> it = rrule.getDateIterator(event.getDateStart().getValue());