mirror of
https://github.com/SimpleMobileTools/Simple-Calendar.git
synced 2025-03-06 04:17:41 +01:00
fix a glitch at events repeating every x weeks
This commit is contained in:
parent
7f80958d5c
commit
9535c5ec5d
@ -147,11 +147,11 @@ data class Event(
|
||||
|
||||
fun getCalDAVCalendarId() = if (source.startsWith(CALDAV)) (source.split("-").lastOrNull() ?: "0").toString().toInt() else 0
|
||||
|
||||
// check if its the proper week, for events repeating every x weeks
|
||||
// check if it's the proper week, for events repeating every x weeks
|
||||
// get the week number since 1970, not just in the current year
|
||||
fun isOnProperWeek(startTimes: LongSparseArray<Long>): Boolean {
|
||||
val initialWeekNumber = Formatter.getDateTimeFromTS(startTimes[id!!]!!).millis / (7 * 24 * 60 * 60 * 1000f)
|
||||
val currentWeekNumber = Formatter.getDateTimeFromTS(startTS).millis / (7 * 24 * 60 * 60 * 1000f)
|
||||
val initialWeekNumber = Formatter.getDateTimeFromTS(startTimes[id!!]!!).withTimeAtStartOfDay().millis / (7 * 24 * 60 * 60 * 1000f)
|
||||
val currentWeekNumber = Formatter.getDateTimeFromTS(startTS).withTimeAtStartOfDay().millis / (7 * 24 * 60 * 60 * 1000f)
|
||||
return (Math.round(initialWeekNumber) - Math.round(currentWeekNumber)) % (repeatInterval / WEEK) == 0
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user