Rename getCycleForCycleStartDay
This commit is contained in:
+5
-7
@@ -50,7 +50,7 @@ export default function config(opts) {
|
|||||||
const i = cycleStartsSortedByDate.indexOf(cycleStart)
|
const i = cycleStartsSortedByDate.indexOf(cycleStart)
|
||||||
const earlierCycleStart = cycleStartsSortedByDate[i + 1]
|
const earlierCycleStart = cycleStartsSortedByDate[i + 1]
|
||||||
if (!earlierCycleStart) return null
|
if (!earlierCycleStart) return null
|
||||||
return getCycleForStartDay(earlierCycleStart)
|
return getCycleForCycleStartDay(earlierCycleStart)
|
||||||
}
|
}
|
||||||
|
|
||||||
function getCyclesBefore(targetCycleStartDay) {
|
function getCyclesBefore(targetCycleStartDay) {
|
||||||
@@ -60,10 +60,10 @@ export default function config(opts) {
|
|||||||
if (startFromHere < 0) return null
|
if (startFromHere < 0) return null
|
||||||
return cycleStartsSortedByDate
|
return cycleStartsSortedByDate
|
||||||
.slice(startFromHere)
|
.slice(startFromHere)
|
||||||
.map(getCycleForStartDay)
|
.map(getCycleForCycleStartDay)
|
||||||
}
|
}
|
||||||
|
|
||||||
function getCycleForStartDay(startDay) {
|
function getCycleForCycleStartDay(startDay) {
|
||||||
const cycleStartIndex = cycleDaysSortedByDate.indexOf(startDay)
|
const cycleStartIndex = cycleDaysSortedByDate.indexOf(startDay)
|
||||||
const i = cycleStartsSortedByDate.indexOf(startDay)
|
const i = cycleStartsSortedByDate.indexOf(startDay)
|
||||||
const nextMensesStart = cycleStartsSortedByDate[i - 1]
|
const nextMensesStart = cycleStartsSortedByDate[i - 1]
|
||||||
@@ -81,7 +81,7 @@ export default function config(opts) {
|
|||||||
const dateString = typeof dayOrDate === 'string' ? dayOrDate : dayOrDate.date
|
const dateString = typeof dayOrDate === 'string' ? dayOrDate : dayOrDate.date
|
||||||
const cycleStart = getLastMensesStartForDay(dateString)
|
const cycleStart = getLastMensesStartForDay(dateString)
|
||||||
if (!cycleStart) return null
|
if (!cycleStart) return null
|
||||||
return getCycleForStartDay(cycleStart)
|
return getCycleForCycleStartDay(cycleStart)
|
||||||
}
|
}
|
||||||
|
|
||||||
function isMensesStart(cycleDay) {
|
function isMensesStart(cycleDay) {
|
||||||
@@ -103,9 +103,7 @@ export default function config(opts) {
|
|||||||
|
|
||||||
function getMensesDaysRightAfter(cycleDay) {
|
function getMensesDaysRightAfter(cycleDay) {
|
||||||
const bleedingDays = bleedingDaysSortedByDate
|
const bleedingDays = bleedingDaysSortedByDate
|
||||||
.filter(d => {
|
.filter(d => !d.bleeding.exclude)
|
||||||
return !d.bleeding.exclude
|
|
||||||
})
|
|
||||||
.reverse()
|
.reverse()
|
||||||
const firstFollowingBleedingDayIndex = bleedingDays.findIndex(day => {
|
const firstFollowingBleedingDayIndex = bleedingDays.findIndex(day => {
|
||||||
return day.date > cycleDay.date
|
return day.date > cycleDay.date
|
||||||
|
|||||||
Reference in New Issue
Block a user