fix #788, always divide caldav event start and end timestamp by a thousand
This commit is contained in:
parent
2dc0c0ec92
commit
42aed15397
|
@ -197,8 +197,8 @@ class CalDAVHelper(val context: Context) {
|
||||||
val id = cursor.getLongValue(CalendarContract.Events._ID)
|
val id = cursor.getLongValue(CalendarContract.Events._ID)
|
||||||
val title = cursor.getStringValue(CalendarContract.Events.TITLE) ?: ""
|
val title = cursor.getStringValue(CalendarContract.Events.TITLE) ?: ""
|
||||||
val description = cursor.getStringValue(CalendarContract.Events.DESCRIPTION) ?: ""
|
val description = cursor.getStringValue(CalendarContract.Events.DESCRIPTION) ?: ""
|
||||||
var startTS = cursor.getLongValue(CalendarContract.Events.DTSTART)
|
val startTS = cursor.getLongValue(CalendarContract.Events.DTSTART) / 1000L
|
||||||
var endTS = cursor.getLongValue(CalendarContract.Events.DTEND)
|
var endTS = cursor.getLongValue(CalendarContract.Events.DTEND) / 1000L
|
||||||
val allDay = cursor.getIntValue(CalendarContract.Events.ALL_DAY)
|
val allDay = cursor.getIntValue(CalendarContract.Events.ALL_DAY)
|
||||||
val rrule = cursor.getStringValue(CalendarContract.Events.RRULE) ?: ""
|
val rrule = cursor.getStringValue(CalendarContract.Events.RRULE) ?: ""
|
||||||
val location = cursor.getStringValue(CalendarContract.Events.EVENT_LOCATION) ?: ""
|
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 originalInstanceTime = cursor.getLongValue(CalendarContract.Events.ORIGINAL_INSTANCE_TIME)
|
||||||
val reminders = getCalDAVEventReminders(id)
|
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) {
|
if (endTS == 0L) {
|
||||||
val duration = cursor.getStringValue(CalendarContract.Events.DURATION) ?: ""
|
val duration = cursor.getStringValue(CalendarContract.Events.DURATION) ?: ""
|
||||||
endTS = startTS + Parser().parseDurationSeconds(duration)
|
endTS = startTS + Parser().parseDurationSeconds(duration)
|
||||||
|
|
Loading…
Reference in New Issue