From 42aed15397a7f09394688363781af6bec832cb9a Mon Sep 17 00:00:00 2001 From: tibbi Date: Fri, 22 Feb 2019 16:54:07 +0100 Subject: [PATCH] fix #788, always divide caldav event start and end timestamp by a thousand --- .../calendar/pro/helpers/CalDAVHelper.kt | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/helpers/CalDAVHelper.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/helpers/CalDAVHelper.kt index 55c15c003..7c63dc09e 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/helpers/CalDAVHelper.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/helpers/CalDAVHelper.kt @@ -197,8 +197,8 @@ class CalDAVHelper(val context: Context) { val id = cursor.getLongValue(CalendarContract.Events._ID) val title = cursor.getStringValue(CalendarContract.Events.TITLE) ?: "" val description = cursor.getStringValue(CalendarContract.Events.DESCRIPTION) ?: "" - var startTS = cursor.getLongValue(CalendarContract.Events.DTSTART) - var endTS = cursor.getLongValue(CalendarContract.Events.DTEND) + val startTS = cursor.getLongValue(CalendarContract.Events.DTSTART) / 1000L + var endTS = cursor.getLongValue(CalendarContract.Events.DTEND) / 1000L val allDay = cursor.getIntValue(CalendarContract.Events.ALL_DAY) val rrule = cursor.getStringValue(CalendarContract.Events.RRULE) ?: "" val location = cursor.getStringValue(CalendarContract.Events.EVENT_LOCATION) ?: "" @@ -206,14 +206,6 @@ class CalDAVHelper(val context: Context) { val originalInstanceTime = cursor.getLongValue(CalendarContract.Events.ORIGINAL_INSTANCE_TIME) val reminders = getCalDAVEventReminders(id) - if (startTS.toString().length == 12 || startTS.toString().length == 13) { - startTS /= 1000L - } - - if (endTS.toString().length == 12 || endTS.toString().length == 13) { - endTS /= 1000L - } - if (endTS == 0L) { val duration = cursor.getStringValue(CalendarContract.Events.DURATION) ?: "" endTS = startTS + Parser().parseDurationSeconds(duration)