Fix bug for just one bleeding day

This commit is contained in:
Julia Friesel
2018-06-11 14:56:34 +02:00
parent ab1ed96966
commit 9922b2e7b8
2 changed files with 21 additions and 1 deletions
+7 -1
View File
@@ -16,7 +16,13 @@ export default function config(opts = {}) {
return day
})
const firstBleedingDayBeforeTargetDayIndex = withWrappedDates.findIndex(day => day.wrappedDate.isBefore(targetDate))
const firstBleedingDayBeforeTargetDayIndex = withWrappedDates.findIndex(day => {
return (
day.wrappedDate.isEqual(targetDate) ||
day.wrappedDate.isBefore(targetDate)
)
})
if (firstBleedingDayBeforeTargetDayIndex < 0) return null
const previousBleedingDays = withWrappedDates.slice(firstBleedingDayBeforeTargetDayIndex)