scripter
scripter

Reputation: 1526

How to make airbnb react date to selecet only a set of dates?

I am using airbnb react dates as a react calendar component. What I want to do is pass an array of dates. And I want to customize the calendar so only those can be selectable by the user. I don't find much in the document. If anyone has ever done this before please let me know. https://github.com/airbnb/react-dates

Upvotes: 2

Views: 2541

Answers (1)

AndreyM
AndreyM

Reputation: 1413

Might be late in the game, but check out isDayBlocked property. It accepts a function that takes a day and returns boolean. e.g. isDayBlocked(day) { return blockedDays.includes(day); }

Another useful prop is isOutsideRange. Has slightly different semantic, but could be useful based on what your requirements are.

More here in "Date selection rules" section: https://github.com/airbnb/react-dates

Upvotes: 1

Related Questions