简体   繁体   English

如何让airbnb反应日期只选择一组日期?

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

I am using airbnb react dates as a react calendar component.我使用 airbnb 反应日期作为反应日历组件。 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 https://github.com/airbnb/react-dates

Might be late in the game, but check out isDayBlocked property.可能会迟到,但请查看isDayBlocked属性。 It accepts a function that takes a day and returns boolean.它接受一个需要一天时间并返回布尔值的函数。 eg isDayBlocked(day) { return blockedDays.includes(day); }例如isDayBlocked(day) { return blockedDays.includes(day); } isDayBlocked(day) { return blockedDays.includes(day); }

Another useful prop is isOutsideRange .另一个有用的道具是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 “日期选择规则”部分的更多信息: https : //github.com/airbnb/react-dates

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM