mirror of
https://github.com/SimpleMobileTools/Simple-Calendar.git
synced 2025-02-19 21:20:43 +01:00
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 eventType = eventTypes.firstOrNull { it.id == curEventTypeId }
|
||||||
val source = if (calDAVCalendarId == 0 || eventType?.isSyncedEventType() == false) SOURCE_IMPORTED_ICS else "$CALDAV-$calDAVCalendarId"
|
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(
|
val event = Event(
|
||||||
null,
|
null,
|
||||||
curStart,
|
curStart,
|
||||||
@ -231,7 +232,7 @@ class IcsImporter(val activity: SimpleActivity) {
|
|||||||
curRepeatExceptions,
|
curRepeatExceptions,
|
||||||
"",
|
"",
|
||||||
curImportId,
|
curImportId,
|
||||||
DateTimeZone.getDefault().id,
|
if (isAllDay) DateTimeZone.UTC.id else DateTimeZone.getDefault().id,
|
||||||
curFlags,
|
curFlags,
|
||||||
curEventTypeId,
|
curEventTypeId,
|
||||||
0,
|
0,
|
||||||
@ -240,7 +241,7 @@ class IcsImporter(val activity: SimpleActivity) {
|
|||||||
curAvailability
|
curAvailability
|
||||||
)
|
)
|
||||||
|
|
||||||
if (event.getIsAllDay() && curEnd > curStart) {
|
if (isAllDay && curEnd > curStart) {
|
||||||
event.endTS -= DAY
|
event.endTS -= DAY
|
||||||
|
|
||||||
// fix some glitches related to daylight saving shifts
|
// fix some glitches related to daylight saving shifts
|
||||||
|
@ -102,7 +102,7 @@ class Parser {
|
|||||||
parseLongFormat(edited, value.endsWith("Z"))
|
parseLongFormat(edited, value.endsWith("Z"))
|
||||||
} else {
|
} else {
|
||||||
val dateTimeFormat = DateTimeFormat.forPattern("yyyyMMdd")
|
val dateTimeFormat = DateTimeFormat.forPattern("yyyyMMdd")
|
||||||
dateTimeFormat.parseDateTime(edited).withHourOfDay(5).seconds()
|
dateTimeFormat.parseDateTime(edited).withHourOfDay(13).seconds()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user