log28 icon indicating copy to clipboard operation
log28 copied to clipboard

Wrong cycleStart in calendar view if cycle is across 2 months

Open precambrien opened this issue 4 years ago • 1 comments

In the calendarView, the first cycle predicted for the next period is wrong if the initial period dates span across two months. _20210517_031531 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.

precambrien avatar May 17 '21 13:05 precambrien

I made a PR for this issue (#13) commit a06561f : a06561f

precambrien avatar May 17 '21 14:05 precambrien