I'm using biweekly 0.4.1 because I need to work with recurring events. One thing I've noticed is that the date from a RECURRENCE-ID property doesn't include timezone information. Here's a test that shows this problem.
importjava.util.Calendar;importjava.util.Date;importjunit.framework.Assert;importorg.junit.Test;importbiweekly.Biweekly;importbiweekly.ICalendar;importbiweekly.component.VEvent;publicclassBiweeklyRecurrenceIdTest{@Testpublicvoidtest(){System.setProperty("user.timezone","GMT");ICalendarical=Biweekly.parse(createCalendar()).first();for(VEventevent:ical.getEvents()){if(event.getRecurrenceId()!=null){//RECURRENCE-ID;TZID=America/New_York:20150119T170000//5pmnewyork==10pmgmtAssert.assertEquals(newDate(2015-1900,Calendar.JANUARY,19,22,0,0),event.getRecurrenceId().getValue());}}}/** * Creates a calendar with a recurring event. One instance of the event is changed so that the calendar * has a VEVENT component with a RECURRENCE-ID property. * * The event is scheduled each week between 17:00 and 18:00. * On 2015/01/19 it's scheduled between 16:00 and 17:00. */privatestaticStringcreateCalendar(){Stringcalendar="BEGIN:VCALENDAR\r\n"+"PRODID:-//Mozilla.org/NONSGML Mozilla Calendar V1.1//EN\r\n"+"VERSION:2.0\r\n"+"BEGIN:VTIMEZONE\r\n"+"TZID:America/New_York\r\n"+"X-LIC-LOCATION:America/New_York\r\n"+"BEGIN:DAYLIGHT\r\n"+"TZOFFSETFROM:-0500\r\n"+"TZOFFSETTO:-0400\r\n"+"TZNAME:EDT\r\n"+"DTSTART:19700308T020000\r\n"+"RRULE:FREQ=YEARLY;BYDAY=2SU;BYMONTH=3\r\n"+"END:DAYLIGHT\r\n"+"BEGIN:STANDARD\r\n"+"TZOFFSETFROM:-0400\r\n"+"TZOFFSETTO:-0500\r\n"+"TZNAME:EST\r\n"+"DTSTART:19701101T020000\r\n"+"RRULE:FREQ=YEARLY;BYDAY=1SU;BYMONTH=11\r\n"+"END:STANDARD\r\n"+"END:VTIMEZONE\r\n"+"BEGIN:VEVENT\r\n"+"CREATED:20150224T081902Z\r\n"+"LAST-MODIFIED:20150224T082003Z\r\n"+"DTSTAMP:20150224T082003Z\r\n"+"UID:0d557873-4922-44df-ba34-4defabf6f912\r\n"+"SUMMARY:Test Event\r\n"+"RRULE:FREQ=WEEKLY\r\n"+"DTSTART;TZID=America/New_York:20150105T170000\r\n"+"DTEND;TZID=America/New_York:20150105T180000\r\n"+"TRANSP:OPAQUE\r\n"+"X-MOZ-GENERATION:1\r\n"+"END:VEVENT\r\n"+"BEGIN:VEVENT\r\n"+"CREATED:20150224T081947Z\r\n"+"LAST-MODIFIED:20150224T082003Z\r\n"+"DTSTAMP:20150224T082003Z\r\n"+"UID:0d557873-4922-44df-ba34-4defabf6f912\r\n"+"SUMMARY:Test Event\r\n"+"RECURRENCE-ID;TZID=America/New_York:20150119T170000\r\n"+"DTSTART;TZID=America/New_York:20150119T160000\r\n"+"DTEND;TZID=America/New_York:20150119T170000\r\n"+"TRANSP:OPAQUE\r\n"+"SEQUENCE:1\r\n"+"X-MOZ-GENERATION:1\r\n"+"END:VEVENT\r\n"+"END:VCALENDAR";returncalendar;}}
This problem is fixed if the following constructor is added to biweekly.property.RecurrenceId.
public class RecurrenceId extends DateOrDateTimeProperty {
public RecurrenceId(ICalDate startDate) {
super(startDate);
}
}
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I'm using biweekly 0.4.1 because I need to work with recurring events. One thing I've noticed is that the date from a RECURRENCE-ID property doesn't include timezone information. Here's a test that shows this problem.
This problem is fixed if the following constructor is added to biweekly.property.RecurrenceId.
Thanks for reporting this. I added the constructor to RecurrenceId. The fix will be included in the next release.
Thanks Michael!