the following code generates multiple RDATE entries in .ics file. Why?
Calendar calendar = new Calendar();
calendar.getProperties().add(new ProdId("-//BSoftware//iCal4j 1.0//EN"));
calendar.getProperties().add(Version.VERSION_2_0);
//calendar.getProperties().add(CalScale.GREGORIAN);
calendar.getProperties().add(Method.REQUEST);
TimeZoneRegistry registry = TimeZoneRegistryFactory.getInstance().createRegistry();
TimeZone timezone = registry.getTimeZone(ApplicationContext.getTimezone());
VTimeZone tz = timezone.getVTimeZone();
calendar.getComponents().add(tz); // vr fix for time zones for MS Outlook calendar
String eventName = meeting.getTitle();
DateTime start = new DateTime(meeting.getMeetingDate());
VEvent event;
if(meeting.getMeetingEndDate() != null)
{
DateTime end = new DateTime(meeting.getMeetingEndDate());
event = new VEvent(start, end, eventName);
}
else
{
event = new VEvent(start, eventName);
}
event.getProperties().add(tz.getTimeZoneId());
event.getProperties().add(new Uid("C20-MEETING-" + meeting.getMeetingId().getId()));
event.getProperties().add(new Status(status));
event.getProperties().add(new Description(VelocityEmailComposer.processTemplate(descriptionTemplateName, parameters)));
event.getProperties().add(new Location(meeting.getLocation()));
Resulted .ics file with multiple RDATE:
BEGIN:VCALENDAR
PRODID:-//BellamySoftware Call2Order//iCal4j 1.0//EN
VERSION:2.0
METHOD:REQUEST
BEGIN:VTIMEZONE
TZID:America/Toronto
TZURL:http://tzurl.org/zoneinfo/America/Toronto
X-LIC-LOCATION:America/Toronto
BEGIN:DAYLIGHT
TZOFFSETFROM:-0500
TZOFFSETTO:-0400
TZNAME:EDT
DTSTART:20070311T020000
RRULE:FREQ=YEARLY;BYMONTH=3;BYDAY=2SU
END:DAYLIGHT
BEGIN:STANDARD
TZOFFSETFROM:-0400
TZOFFSETTO:-0500
TZNAME:EST
DTSTART:20071104T020000
RRULE:FREQ=YEARLY;BYMONTH=11;BYDAY=1SU
END:STANDARD
BEGIN:STANDARD
TZOFFSETFROM:-051732
TZOFFSETTO:-0500
TZNAME:EST
DTSTART:18950101T000000
RDATE:18950101T000000
END:STANDARD
BEGIN:DAYLIGHT
TZOFFSETFROM:-0500
TZOFFSETTO:-0400
TZNAME:EDT
DTSTART:19180414T020000
RDATE:19180414T020000
RDATE:19190330T233000
RDATE:19200502T020000
RDATE:19210515T020000
RDATE:19220514T020000
RDATE:19230513T020000
RDATE:19240504T020000
RDATE:19250503T020000
RDATE:19260502T020000
RDATE:19270501T020000
RDATE:19280429T020000
RDATE:19290428T020000
RDATE:19300427T020000
RDATE:19310426T020000
RDATE:19320501T020000
RDATE:19330430T020000
RDATE:19340429T020000
RDATE:19350428T020000
RDATE:19360426T020000
RDATE:19370425T020000
RDATE:19380424T020000
RDATE:19390430T020000
RDATE:19400428T020000
RDATE:19460428T020000
RDATE:19470427T000000
RDATE:19480425T000000
RDATE:19490424T000000
RDATE:19500430T020000
RDATE:19510429T020000
RDATE:19520427T020000
RDATE:19530426T020000
RDATE:19540425T020000
RDATE:19550424T020000
RDATE:19560429T020000
RDATE:19570428T020000
RDATE:19580427T020000
RDATE:19590426T020000
RDATE:19600424T020000
RDATE:19610430T020000
RDATE:19620429T020000
RDATE:19630428T020000
RDATE:19640426T020000
RDATE:19650425T020000
RDATE:19660424T020000
RDATE:19670430T020000
RDATE:19680428T020000
RDATE:19690427T020000
RDATE:19700426T020000
RDATE:19710425T020000
RDATE:19720430T020000
RDATE:19730429T020000
RDATE:19740428T020000
RDATE:19750427T020000
RDATE:19760425T020000
RDATE:19770424T020000
RDATE:19780430T020000
RDATE:19790429T020000
RDATE:19800427T020000
RDATE:19810426T020000
RDATE:19820425T020000
RDATE:19830424T020000
RDATE:19840429T020000
RDATE:19850428T020000
RDATE:19860427T020000
RDATE:19870405T020000
RDATE:19880403T020000
RDATE:19890402T020000
RDATE:19900401T020000
RDATE:19910407T020000
RDATE:19920405T020000
RDATE:19930404T020000
RDATE:19940403T020000
RDATE:19950402T020000
RDATE:19960407T020000
RDATE:19970406T020000
RDATE:19980405T020000
RDATE:19990404T020000
RDATE:20000402T020000
RDATE:20010401T020000
RDATE:20020407T020000
RDATE:20030406T020000
RDATE:20040404T020000
RDATE:20050403T020000
RDATE:20060402T020000
END:DAYLIGHT
BEGIN:STANDARD
TZOFFSETFROM:-0400
TZOFFSETTO:-0500
TZNAME:EST
DTSTART:19181027T020000
RDATE:19181027T020000
RDATE:19191026T000000
RDATE:19200926T000000
RDATE:19210915T020000
RDATE:19220917T020000
RDATE:19230916T020000
RDATE:19240921T020000
RDATE:19250920T020000
RDATE:19260919T020000
RDATE:19270925T020000
RDATE:19280930T020000
RDATE:19290929T020000
RDATE:19300928T020000
RDATE:19310927T020000
RDATE:19320925T020000
RDATE:19331001T020000
RDATE:19340930T020000
RDATE:19350929T020000
RDATE:19360927T020000
RDATE:19370926T020000
RDATE:19380925T020000
RDATE:19390924T020000
RDATE:19450930T020000
RDATE:19460929T020000
RDATE:19470928T000000
RDATE:19480926T000000
RDATE:19491127T000000
RDATE:19501126T020000
RDATE:19510930T020000
RDATE:19520928T020000
RDATE:19530927T020000
RDATE:19540926T020000
RDATE:19550925T020000
RDATE:19560930T020000
RDATE:19571027T020000
RDATE:19581026T020000
RDATE:19591025T020000
RDATE:19601030T020000
RDATE:19611029T020000
RDATE:19621028T020000
RDATE:19631027T020000
RDATE:19641025T020000
RDATE:19651031T020000
RDATE:19661030T020000
RDATE:19671029T020000
RDATE:19681027T020000
RDATE:19691026T020000
RDATE:19701025T020000
RDATE:19711031T020000
RDATE:19721029T020000
RDATE:19731028T020000
RDATE:19741027T020000
RDATE:19751026T020000
RDATE:19761031T020000
RDATE:19771030T020000
RDATE:19781029T020000
RDATE:19791028T020000
RDATE:19801026T020000
RDATE:19811025T020000
RDATE:19821031T020000
RDATE:19831030T020000
RDATE:19841028T020000
RDATE:19851027T020000
RDATE:19861026T020000
RDATE:19871025T020000
RDATE:19881030T020000
RDATE:19891029T020000
RDATE:19901028T020000
RDATE:19911027T020000
RDATE:19921025T020000
RDATE:19931031T020000
RDATE:19941030T020000
RDATE:19951029T020000
RDATE:19961027T020000
RDATE:19971026T020000
RDATE:19981025T020000
RDATE:19991031T020000
RDATE:20001029T020000
RDATE:20011028T020000
RDATE:20021027T020000
RDATE:20031026T020000
RDATE:20041031T020000
RDATE:20051030T020000
RDATE:20061029T020000
END:STANDARD
BEGIN:STANDARD
TZOFFSETFROM:-0500
TZOFFSETTO:-0500
TZNAME:EST
DTSTART:19190101T000000
RDATE:19190101T000000
RDATE:19460101T000000
RDATE:19740101T000000
END:STANDARD
BEGIN:DAYLIGHT
TZOFFSETFROM:-0400
TZOFFSETTO:-0400
TZNAME:EWT
DTSTART:19420209T020000
RDATE:19420209T020000
END:DAYLIGHT
BEGIN:DAYLIGHT
TZOFFSETFROM:-0400
TZOFFSETTO:-0400
TZNAME:EPT
DTSTART:19450814T190000
RDATE:19450814T190000
END:DAYLIGHT
END:VTIMEZONE
BEGIN:VEVENT
DTSTAMP:20141218T175953Z
DTSTART:20141218T150000
SUMMARY:Test 3
TZID:America/Toronto
UID:C20-MEETING-20141218001
STATUS:CONFIRMED
DESCRIPTION:You have been invited to the Meeting Test 3\n\nMeeting Time:
2014/12/18 3:00 PM\n\nLocation: \n\n------------------------------------
-------------------------\nThis is an automatic email notification. Plea
se DO NOT REPLY.\n------------------------------------------------------
-------
LOCATION:
ATTENDEE;ROLE=REQ-PARTICIPANT;RSVP=TRUE:mailto:Vitaly.Romanishko@sylogist
.com
ORGANIZER:mailto:[email protected]
END:VEVENT
END:VCALENDAR
If you only care about events in the future (or at least after 2006), you can remove all DAYLIGHT and STANDARD subcomponents from the VTIMEZONE component except for the most recent ones which do contain an associated RRULE, i.e.: