Skip to content

Commit 729a632

Browse files
committed
fix #599, properly determing if all-day events are running, or not
1 parent ec2b71e commit 729a632

File tree

1 file changed

+14
-2
lines changed
  • app/src/main/kotlin/com/simplemobiletools/calendar/helpers

1 file changed

+14
-2
lines changed

app/src/main/kotlin/com/simplemobiletools/calendar/helpers/DBHelper.kt

+14-2
Original file line numberDiff line numberDiff line change
@@ -939,7 +939,12 @@ class DBHelper private constructor(val context: Context) : SQLiteOpenHelper(cont
939939
repeatRule = REPEAT_SAME_DAY
940940
}
941941

942-
val isPastEvent = endTS < getNowSeconds()
942+
val endTSToCheck = if (startTS < getNowSeconds() && flags and FLAG_ALL_DAY != 0) {
943+
Formatter.getDayEndTS(Formatter.getDayCodeFromTS(endTS))
944+
} else {
945+
endTS
946+
}
947+
val isPastEvent = endTSToCheck < getNowSeconds()
943948

944949
val event = Event(id, startTS, endTS, title, description, reminder1Minutes, reminder2Minutes, reminder3Minutes,
945950
repeatInterval, importId, flags, repeatLimit, repeatRule, eventType, ignoreEventOccurrences, offset, isDstIncluded,
@@ -1070,5 +1075,12 @@ class DBHelper private constructor(val context: Context) : SQLiteOpenHelper(cont
10701075
}
10711076
}
10721077

1073-
private fun getIsPastEvent(event: Event) = event.endTS < getNowSeconds()
1078+
private fun getIsPastEvent(event: Event): Boolean {
1079+
val endTSToCheck = if (event.startTS < getNowSeconds() && event.getIsAllDay()) {
1080+
Formatter.getDayEndTS(Formatter.getDayCodeFromTS(event.endTS))
1081+
} else {
1082+
event.endTS
1083+
}
1084+
return endTSToCheck < getNowSeconds()
1085+
}
10741086
}

0 commit comments

Comments
 (0)