Merge pull request #1875 from Naveen3Singh/bug_fix_all_day_events

Ignore stored hour for all-day events in weekly view
This commit is contained in:
Tibor Kaputa 2022-11-09 15:04:33 +01:00 committed by GitHub
commit c7631bfee8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 5 deletions

View File

@ -452,20 +452,22 @@ class WeekFragment : Fragment(), WeeklyCalendar {
val startDayCode = Formatter.getDayCodeFromDateTime(startDateTime)
val endDateTime = Formatter.getDateTimeFromTS(event.endTS)
val endDayCode = Formatter.getDayCodeFromDateTime(endDateTime)
val isAllDay = event.getIsAllDay()
if ((event.getIsAllDay() || (startDayCode != endDayCode)) && config.showMidnightSpanningEventsAtTop) {
if ((isAllDay || (startDayCode != endDayCode)) && config.showMidnightSpanningEventsAtTop) {
continue
}
var currentDateTime = startDateTime
var currentDayCode = Formatter.getDayCodeFromDateTime(currentDateTime)
do {
val startMinutes = when (currentDayCode == startDayCode) {
true -> (startDateTime.minuteOfDay)
// all-day events always start at the 0 minutes and end at the end of the day (1440 minutes)
val startMinutes = when {
currentDayCode == startDayCode && !isAllDay -> (startDateTime.minuteOfDay)
else -> 0
}
val duration = when (currentDayCode == endDayCode) {
true -> (endDateTime.minuteOfDay - startMinutes)
val duration = when {
currentDayCode == endDayCode && !isAllDay -> (endDateTime.minuteOfDay - startMinutes)
else -> 1440
}