log28
log28 copied to clipboard
Wrong cycleStart in calendar view if cycle is across 2 months
In the calendarView, the first cycle predicted for the next period is wrong if the initial period dates span across two months.
In this example, the cycle starts on 28/04 so the next cycle should start on 26/05 (using a 28 length default cycle).
I think the error is in
predictFuturePeriods(...) in CalendarView.kt, l.106 :
var cycleStart = periodDates.filter { item -> item -1 !in periodDates }.max()?.toCalendar()
item is in long format so item -1 won't work for a cycle across two months. Here, cycleStart should be 20210328 but is 20210401 as item -1 (20210400) is not in periodDates.
I made a PR for this issue (#13)
commit a06561f :