Open Yaya-Dev-Box opened 2 years ago
I'm trying to fix this myself by modifying the library's codes, could you tell me what is the code responsible for drawing the event chips so I can investigate there?
Found the issue:
In the ResolvedWeekViewEvent.kt
class, replace:
internal fun isWithin( minHour: Int, maxHour: Int ): Boolean = startTime.hour >= minHour && endTime.hour <= maxHour
by
internal fun isWithin( minHour: Int, maxHour: Int ): Boolean = startTime.hour >= minHour || endTime.hour <= maxHour
Awesome library and code structure by the way :) thank you.
Update, I improved the code to cover more edge cases:
internal fun isWithin(
minHour: Int,
maxHour: Int
): Boolean {
val startTimeIsInRange = startTime.hour in minHour..maxHour
val endTimeIsInRange = endTime.hour in minHour..maxHour
val eventHoursStartBeforeAndEndAfterLimits = (startTime.hour..endTime.hour intersect minHour..maxHour).isNotEmpty()
val eventIsMultiDay = endTime.toEpochDays() - startTime.toEpochDays() > 0
return startTimeIsInRange || endTimeIsInRange || eventHoursStartBeforeAndEndAfterLimits || eventIsMultiDay
}
Please be careful with eventIsMultiDay
, as it accepts all events that span across multiple days, even if they don't intersect with minHour
and maxHour
.
Describe the bug Setting "minHour" or "maxHour" to other values than 0 and 24 will cause the partially out of range events to disappear (depends on the duration of the event)
To Reproduce See the attached video
https://user-images.githubusercontent.com/58863987/159453904-ec57c85e-95fb-461f-89b2-65a1b93c061f.mp4
Expected behavior The events should still be shown, even partially (same as the multi day events in the basic sample)
Additional context