Skip to content
Advertisement

How to show only specific days react-dates

I have array of days.

JavaScript

I only want to show the above selected days in the airbnb datepicker and disable the other ones.

JavaScript

How can I do that? Thank you

Advertisement

Answer

You will have to use the isDayBlocked prop of the date picker. The following function will find if a day is contained inside your array, and return true if it does not find any :

JavaScript

It uses the isSame function of moment.js : https://momentjs.com/docs/#/query/is-same/

Then bind your function :

JavaScript
User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement