Search code examples
javagroovyrfc5545recurring-eventsical4j

Ical4j. RFC5545. Calculate event occurrences with exclusion


I check ical4j library. At time I need calculate event occurrences. Useful example to calculate is here. I try to add exclusion

    VEvent event = new ContentBuilder().vevent {
        dtstart('20101113', parameters: parameters() {value('DATE')})
        dtend('20101114', parameters: parameters() {value('DATE')})
        rrule('FREQ=WEEKLY;WKST=MO;INTERVAL=3;BYDAY=MO,TU,SA')
        // I've added next row, the value is present in result occurrences
        exdate('20101221T000000Z/P1D')
    }
    def dates = event.calculateRecurrenceSet(new Period('20101101T000000/20110101T000000'))
    println dates

But occurrences calculation does not changed. Can anyone fix me please?


Solution

  • You shouldn't include:

    /P1D
    

    To exclude one date you can use the following:

    exdate('20101221T000000Z')
    

    Providing you need to exclude more than one date, you can separate them by comma:

    exdate('20101129T000000Z,20101221T000000Z')