Shorten pre-ovu phase when early mucus

This commit is contained in:
Julia Friesel
2018-07-10 17:04:54 +02:00
parent d027c6e9c4
commit 60c6189466
3 changed files with 57 additions and 3 deletions
+8 -1
View File
@@ -5,13 +5,20 @@ export default function(cycle) {
const fiveDayEndDate = startDate.plusDays(4).toString()
const fiveDayRuleDays = cycle.slice(0, 5).filter(d => d.date <= fiveDayEndDate)
const preOvulatoryDays = getDaysUntilFertileMucus(fiveDayRuleDays)
let endDate
if (preOvulatoryDays.length === fiveDayRuleDays.length) {
endDate = fiveDayEndDate
} else {
endDate = preOvulatoryDays[preOvulatoryDays.length - 1].date
}
return {
cycleDays: preOvulatoryDays,
start: {
date: preOvulatoryDays[0].date
},
end: {
date: fiveDayEndDate
date: endDate
}
}
}