简体   繁体   中英

How to add multiple blocked dates color in airbnb calendar?

How can i add multiple blocked dates color in Reactjs airbnb calendar api?

ex:

  • Red = special holiday
  • Grey = unavailable
  • blue = special non-working holiday

You can use renderDayContents method. For example:

<DateRangePicker
  renderDayContents={(day) => {
    if (day.format('DD-MM') === '19-07')
      return <td className={classes.specialHoliday}>{day.format('DD')}</td>;
    if (day.format('DD-MM') === '18-07')
      return <td className={classes.unavailable}>{day.format('DD')}</td>;
    if (day.format('DD-MM') === '20-07')
      return (
        <td className={classes.specialNonWorkingHoliday}>
          {day.format('DD')}
        </td>
      );
    return <td>{day.format('DD')}</td>;
  }}
  ..........
/>

在此处输入图像描述

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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