mirror of
https://github.com/etesync/android
synced 2025-06-10 18:18:50 +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:
parent
0f42c0e923
commit
828254a1f7
@ -224,7 +224,7 @@ public class CalendarSyncManager extends SyncManager {
|
|||||||
|
|
||||||
private static String formatEventDates(Event event) {
|
private static String formatEventDates(Event event) {
|
||||||
final Locale locale = Locale.getDefault();
|
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 =
|
final String dateFormatString =
|
||||||
event.isAllDay() ? "EEEE, MMM dd" : "EEEE, MMM dd @ hh:mm a";
|
event.isAllDay() ? "EEEE, MMM dd" : "EEEE, MMM dd @ hh:mm a";
|
||||||
final DateFormat longDateFormat =
|
final DateFormat longDateFormat =
|
||||||
@ -236,9 +236,8 @@ public class CalendarSyncManager extends SyncManager {
|
|||||||
|
|
||||||
Date startDate = event.dtStart.getDate();
|
Date startDate = event.dtStart.getDate();
|
||||||
Date endDate = event.getEndDate(true).getDate();
|
Date endDate = event.getEndDate(true).getDate();
|
||||||
final String tzName = (timezone != null) ?
|
final String tzName = timezone.getDisplayName(timezone.inDaylightTime(startDate), TimeZone.SHORT);
|
||||||
timezone.getDisplayName(timezone.inDaylightTime(startDate), TimeZone.SHORT)
|
|
||||||
: "UTC";
|
|
||||||
Calendar cal1 = Calendar.getInstance();
|
Calendar cal1 = Calendar.getInstance();
|
||||||
Calendar cal2 = Calendar.getInstance();
|
Calendar cal2 = Calendar.getInstance();
|
||||||
cal1.setTime(startDate);
|
cal1.setTime(startDate);
|
||||||
|
Loading…
Reference in New Issue
Block a user