Use explicit dates with gaps and fix bugs that this uncovers
This commit is contained in:
@@ -1,5 +1,9 @@
|
||||
import { LocalDate } from "js-joda"
|
||||
|
||||
export default function(cycle) {
|
||||
const fiveDayRuleDays = cycle.slice(0, 5)
|
||||
const startDate = LocalDate.parse(cycle[0].date)
|
||||
const fiveDayEndDate = startDate.plusDays(4).toString()
|
||||
const fiveDayRuleDays = cycle.slice(0, 5).filter(d => d.date <= fiveDayEndDate)
|
||||
const preOvulatoryDays = getDaysUntilFertileMucus(fiveDayRuleDays)
|
||||
return {
|
||||
cycleDays: preOvulatoryDays,
|
||||
@@ -7,7 +11,7 @@ export default function(cycle) {
|
||||
date: preOvulatoryDays[0].date
|
||||
},
|
||||
end: {
|
||||
date: preOvulatoryDays[preOvulatoryDays.length - 1].date,
|
||||
date: fiveDayEndDate
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user