Skip to content

Commit

Permalink
Fix apache#838 TimeZone-less DTSTART and DTEND not changed to GMT
Browse files Browse the repository at this point in the history
in native mode with GraalVM 20.1.0+
  • Loading branch information
ppalaga committed Jun 30, 2020
1 parent 085984d commit e91db3f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -82,16 +82,7 @@ protected static Calendar createTestCalendar(ZonedDateTime start, ZonedDateTime
}

static DateTime toDateTime(ZonedDateTime zonedDateTime, TimeZoneRegistry registry) {
final String tzId = zonedDateTime.getZone().getId();
final TimeZone timezone = registry.getTimeZone(tzId.equals("Z") ? "UTC" : tzId);
// workaround for https://github.com/apache/camel-quarkus/issues/838
final DateTime result = new DateTime();
result.setTimeZone(timezone);
result.setTime(zonedDateTime.toInstant().toEpochMilli());
// To reproduce https://github.com/apache/camel-quarkus/issues/838 comment the above, enable the following
// and remove the TZ from DTSTART and DTEND in src/test/resources/test.ics
// final DateTime result = new DateTime(zonedDateTime.toInstant().toEpochMilli());
return result;
return new DateTime(zonedDateTime.toInstant().toEpochMilli());
}

}
4 changes: 2 additions & 2 deletions integration-tests/dataformat/src/test/resources/test.ics
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ PRODID:-//Events Calendar//iCal4j 1.0//EN
CALSCALE:GREGORIAN
BEGIN:VEVENT
DTSTAMP:19700101T000000Z
DTSTART;TZID=Europe/Paris:20071203T101530
DTEND;TZID=Europe/Paris:20071203T111631
DTSTART:20071203T101530
DTEND:20071203T111631
SUMMARY:Progress Meeting
TZID:Europe/Paris
UID:00000000
Expand Down

0 comments on commit e91db3f

Please sign in to comment.