possible to get all cycle lengths, which get evaluated in stats

This commit is contained in:
tina
2018-08-08 16:05:39 +02:00
parent 897e99e6af
commit 6135c92268
2 changed files with 41 additions and 14 deletions
+19 -2
View File
@@ -130,11 +130,28 @@ export default function config(opts) {
}
}
function getAllMensesStarts(day, collectedDates) {
day = day || LocalDate.now().toString()
collectedDates = collectedDates || []
if (!day) {
return null
} else {
const lastStart = getLastMensesStart(day)
if (!lastStart) {
return collectedDates
} else {
const newDay = LocalDate.parse(lastStart.date).minusDays(1).toString()
collectedDates.push(lastStart.date)
return getAllMensesStarts(newDay, collectedDates)
}
}
}
return {
getCycleDayNumber,
getCycleForDay,
getPreviousCycle,
getCyclesBefore,
getLastMensesStart
getLastMensesStart,
getAllMensesStarts
}
}