Use UTC timezone when importing all day events
Related issues: https://github.com/SimpleMobileTools/Simple-Calendar/issues/1539 https://github.com/SimpleMobileTools/Simple-Calendar/issues/1480 https://github.com/SimpleMobileTools/Simple-Calendar/issues/1521
This commit is contained in:
parent
c444c476b3
commit
cf20782fd9
|
@ -212,6 +212,7 @@ class IcsImporter(val activity: SimpleActivity) {
|
|||
|
||||
val eventType = eventTypes.firstOrNull { it.id == curEventTypeId }
|
||||
val source = if (calDAVCalendarId == 0 || eventType?.isSyncedEventType() == false) SOURCE_IMPORTED_ICS else "$CALDAV-$calDAVCalendarId"
|
||||
val isAllDay = curFlags and FLAG_ALL_DAY != 0
|
||||
val event = Event(
|
||||
null,
|
||||
curStart,
|
||||
|
@ -231,7 +232,7 @@ class IcsImporter(val activity: SimpleActivity) {
|
|||
curRepeatExceptions,
|
||||
"",
|
||||
curImportId,
|
||||
DateTimeZone.getDefault().id,
|
||||
if (isAllDay) DateTimeZone.UTC.id else DateTimeZone.getDefault().id,
|
||||
curFlags,
|
||||
curEventTypeId,
|
||||
0,
|
||||
|
@ -240,7 +241,7 @@ class IcsImporter(val activity: SimpleActivity) {
|
|||
curAvailability
|
||||
)
|
||||
|
||||
if (event.getIsAllDay() && curEnd > curStart) {
|
||||
if (isAllDay && curEnd > curStart) {
|
||||
event.endTS -= DAY
|
||||
|
||||
// fix some glitches related to daylight saving shifts
|
||||
|
|
|
@ -102,7 +102,7 @@ class Parser {
|
|||
parseLongFormat(edited, value.endsWith("Z"))
|
||||
} else {
|
||||
val dateTimeFormat = DateTimeFormat.forPattern("yyyyMMdd")
|
||||
dateTimeFormat.parseDateTime(edited).withHourOfDay(5).seconds()
|
||||
dateTimeFormat.parseDateTime(edited).withHourOfDay(13).seconds()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue