I am trying to iterate an event across a daylight savings change with the Java BiWeekly library.
Say the event starts at 8am, I want it to stay at 8am regardless of whether daylight savings is in effect or not.
The following code is from the BiWeekly website: https://github.com/mangstadt/biweekly/wiki/Examples#calculating-the-dates-in-a-recurring-event
ICalendar ical = ...
TimezoneInfo tzinfo = ical.getTimezoneInfo();
VEvent event = ical.getEvents().get(0);
DateStart dtstart = event.getDateStart();
TimeZone timezone;
if (tzinfo.isFloating(dtstart)){
timezone = TimeZone.getDefault();
} else {
TimezoneAssignment dtstartTimezone = tzinfo.getTimezone(dtstart);
timezone = (dtstartTimezone == null) ? TimeZone.getTimeZone("UTC") : dtstartTimezone.getTimeZone();
}
DateIterator it = event.getDateIterator(timezone);
If I have a celendar created as:
BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//Michael Angstadt//biweekly 0.6.3//EN
BEGIN:VEVENT
UID:deb01413-942a-4ea9-a53c-541493fa668a
DTSTAMP:20200213T051827Z
SUMMARY;LANGUAGE=en-us:Team Meeting
DTSTART;TZID=/Pacific/Auckland:20200213T181827
DURATION:PT1H
RRULE:FREQ=WEEKLY;INTERVAL=2
END:VEVENT
END:VCALENDAR
Iterating over this, the time changes by an hour as it crosses the daylight savings boundary.
How should it be done to keep the occurrences occurring at the given time? (It is correct that it occurs at the same time in UTC, but I want it to occur at the same time locally.)