Skip to content

Commit

Permalink
SAK-40670 - Calendar doesn't check summer or winter time on external …
Browse files Browse the repository at this point in the history
…subscribing events (sakaiproject#6043)
  • Loading branch information
SedueRey authored and ern committed Oct 4, 2018
1 parent 273d979 commit 784b6da
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.TimeZone;

import org.sakaiproject.calendar.impl.GenericCalendarImporter;
import org.sakaiproject.exception.ImportException;
Expand Down Expand Up @@ -238,6 +239,10 @@ public List filterEvents(List events, String[] customFieldNames, String tzid) th
// Raw + calendar/owner TZ's offset
ZonedDateTime srcZonedDateTime = startInstant.atZone(srcZoneId);
long millis = startInstant.plusMillis(srcZonedDateTime.getOffset().getTotalSeconds() * 1000).toEpochMilli();
TimeZone tz = TimeZone.getTimeZone(tzid);
if( tz.inDaylightTime(startDate) ) {
millis = millis - tz.getDSTSavings();
}

// Duration of event
Duration gapMinutes = Duration.ofMinutes(durationInMinutes);
Expand Down

0 comments on commit 784b6da

Please sign in to comment.