onefinestay / react-daterange-picker

Other
563 stars 209 forks source link

unavailable dates shows half days on the calendar #237

Open anneleenpeeters opened 4 years ago

anneleenpeeters commented 4 years ago

When I select a room, the unavailable dates appear. Instead of a series of unavailable dates, he only shows the half days of this series in the calendar. But when I click on my due date, it does show the full set of unavailable dates.

When I select a room:

Schermafbeelding 2020-06-19 om 11 46 53

When I clicked on the end date:

Schermafbeelding 2020-06-19 om 11 47 29

What it should do: So what I would like is that the calendar immediately shows the full range of unavailable dates instead of only showing when I have indicated the end date.

This is my code:

Schermafbeelding 2020-06-19 om 11 51 08

This code:

setDateRanges(dateRanges => dateRanges.sort((a, b) => moment(a.range.start).isBefore(moment(b.range.start)) ? -1 : 1))

This code sorts the dates in the correct order and should normally solve this problem. But in my code it doesn't solve this problem.

Does anyone have an idea how I can fix this? Thank you