From 34e1717dcdc2331da4e7cac376ba078f51998316 Mon Sep 17 00:00:00 2001 From: tibbi Date: Mon, 17 Jul 2017 20:42:43 +0200 Subject: [PATCH] subtract a day from all-day events lasting multiple days --- .../calendar/asynctasks/FetchGoogleEventsTask.kt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/asynctasks/FetchGoogleEventsTask.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/asynctasks/FetchGoogleEventsTask.kt index 580a31bb0..d6087deca 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/asynctasks/FetchGoogleEventsTask.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/asynctasks/FetchGoogleEventsTask.kt @@ -14,6 +14,7 @@ import com.simplemobiletools.calendar.activities.SettingsActivity import com.simplemobiletools.calendar.extensions.config import com.simplemobiletools.calendar.extensions.dbHelper import com.simplemobiletools.calendar.extensions.seconds +import com.simplemobiletools.calendar.helpers.DAY import com.simplemobiletools.calendar.helpers.FLAG_ALL_DAY import com.simplemobiletools.calendar.helpers.Parser import com.simplemobiletools.calendar.helpers.RRULE @@ -128,6 +129,10 @@ class FetchGoogleEventsTask(val activity: Activity, credential: GoogleAccountCre reminders.getOrElse(2, { -1 }), repeatRule.repeatInterval, importId, flags, repeatRule.repeatLimit, repeatRule.repeatRule, eventTypeId) + if (event.isAllDay && endTS > startTS) { + event.endTS -= DAY + } + importIDs.add(importId) dbHelper.insert(event) {} }