multiple "unavailable" blocks
Opened this issue ยท 9 comments
@bensialih Would you mid posting your configuration? I'm unable to replicate locally:
I had this kind of problem when I used to set single days as unavailable, not ranges.
ooo the plot thickens.
I think any kind of mutation of the moment object tends to start creating problems.
If I format the date before I pass it to the frontend it works fine but once its parsed theres issues.
If I use .utcOffset on moment, it cuts off the date when its rendered to the calendar.
I think the original error had moment time changed.
I seem to have the same problem! I use an async function to fetch some unavailable dates, and then I make an array of the desired form. then I send the array to DateRangePicker, and if it is longer than one, I get this pattern as well:
@AlanFoster Do you have any idea?
I think the problem starts somewhere here.:
when a date is not a boundary, the states
should only contain one date, what you use to determine the numStates
later on, and finally if the date should be rendered as fully colored, or just half.
But dateRangesForDate
returns more than one dates even if it is not a boundary.
I came across this issue today and realised that I fixed it previously. You have to provide your date ranges in chronological order. Add this line to the end of your dateStates array:
dateStates.sort((a, b) => moment(a.range.start).isBefore(moment(b.range.start)) ? -1 : 1