Respect maxcyclelength in getCycleForStartDay
This commit is contained in:
+5
-2
@@ -65,17 +65,20 @@ export default function config(opts) {
|
||||
}
|
||||
|
||||
function getCycleForCycleStartDay(startDay) {
|
||||
// TODO this needs to be made cycle length aware. all other places can go?
|
||||
const cycleStartIndex = cycleDaysSortedByDate.indexOf(startDay)
|
||||
const i = cycleStartsSortedByDate.indexOf(startDay)
|
||||
const nextMensesStart = cycleStartsSortedByDate[i - 1]
|
||||
let cycle
|
||||
if (nextMensesStart) {
|
||||
return cycleDaysSortedByDate.slice(
|
||||
cycle = cycleDaysSortedByDate.slice(
|
||||
cycleDaysSortedByDate.indexOf(nextMensesStart) + 1,
|
||||
cycleStartIndex + 1,
|
||||
)
|
||||
} else {
|
||||
return cycleDaysSortedByDate.slice(0, cycleStartIndex + 1)
|
||||
cycle = cycleDaysSortedByDate.slice(0, cycleStartIndex + 1)
|
||||
}
|
||||
return cycle.length > maxCycleLength ? null : cycle
|
||||
}
|
||||
|
||||
function getCycleForDay(dayOrDate) {
|
||||
|
||||
Reference in New Issue
Block a user