1
0
mirror of https://github.com/etesync/android synced 2024-12-22 22:58:29 +00:00

Event invites: gracefully handle missing timezone information.

The code before didn't fallback to UTC nicely and was causing a crash.
This commit is contained in:
Tom Hacohen 2019-01-04 20:32:35 +00:00
parent 0f42c0e923
commit 828254a1f7

View File

@ -224,7 +224,7 @@ public class CalendarSyncManager extends SyncManager {
private static String formatEventDates(Event event) {
final Locale locale = Locale.getDefault();
final TimeZone timezone = event.dtStart.getTimeZone();
final TimeZone timezone = (event.dtStart.getTimeZone() != null) ? event.dtStart.getTimeZone() : TimeZone.getTimeZone("UTC");
final String dateFormatString =
event.isAllDay() ? "EEEE, MMM dd" : "EEEE, MMM dd @ hh:mm a";
final DateFormat longDateFormat =
@ -236,9 +236,8 @@ public class CalendarSyncManager extends SyncManager {
Date startDate = event.dtStart.getDate();
Date endDate = event.getEndDate(true).getDate();
final String tzName = (timezone != null) ?
timezone.getDisplayName(timezone.inDaylightTime(startDate), TimeZone.SHORT)
: "UTC";
final String tzName = timezone.getDisplayName(timezone.inDaylightTime(startDate), TimeZone.SHORT);
Calendar cal1 = Calendar.getInstance();
Calendar cal2 = Calendar.getInstance();
cal1.setTime(startDate);