iCal4j RDATE ics 文件中的多个条目



以下代码.ics文件中生成多个 RDATE 条目。为什么?

    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())); 

结果.ics具有多个 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 3nnMeeting Time: 
 2014/12/18 3:00 PMnnLocation: nn------------------------------------
 -------------------------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:Vitaly.Romanishko@sylogist.com
END:VEVENT
END:VCALENDAR

RDATE属性的列表在您的VTIMEZONE中。iCalendar软件可以通过RRULE使它更短,但这些计算很难,并不是每个人都能实现它。

不过,您的iCalendar数据是正确的。将来,您可能希望研究如何在堆栈溢出时更好地格式化代码。

如果您只关心未来(或至少在 2006 年之后(的事件,您可以从 VTIMEZONE 组件中删除所有 DAYLIGHT 和 STANDARD 子组件,但包含相关 RRULE 的最新组件除外,即:

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

相关内容

  • 没有找到相关文章

最新更新