I'm trying to use the react bootsrap DateRangePicker but I really don't understand the proper way to use the isInvalidDate option.
This is the definition for it:
isInvalidDate: (function) A function that is passed each date in the two calendars before they are displayed, and may return true or false to indicate whether that date should be available for selection or not.
What I need the function to do is to check my array of booked dates retrived from my server, and disable the booked ones.
This is the code I've written and that isn't working:
function checkInvalidDate(date) {
if(bookedTimes.map(booking => (
booking === date.toISOString()
))) {
return true
} else {
return false
}
}
I'm using a functional component in React.
Anyone has experience with this picker and can help me out understanding what I'm doing wrong and what is the correct way to use the isInvalidDate option?
Thank you!