React-dates: Add custom modifiers for DayPickerRangeController and DayPickerSingleController

Created on 3 Jul 2017  路  3Comments  路  Source: airbnb/react-dates

What do you think about custom modifiers for DayPickerRangeController and DayPickerSingleController?

Using these controllers we can highlight a day using isDayHighlighted. It works very well when we have a single case of hightlighted days.

I am wondering if there is an easy way to add a custom highlight for scenarios where you have more than one, eg.: Special days and Very special days.

Something like:

const myModifiers = {
  'important-event-but-not-a-highlight': day => this.props.importantEvent(day),
}
<DayPickerSingleController
  ...
  modifiers={myModifiers}
  />

Then we could use the .CalendarDay--important-event-but-not-a-highlight class to style this cell.

Do you think it would be useful? Is there another way to highlight a day other than isDayHighlighted?

Cheers!

Most helpful comment

I need this to add half day styling to checkin/checkout days.

All 3 comments

I need this to add half day styling to checkin/checkout days.

I would find it useful if we could define acceptable modifiers for the controller, just as in the example above and then in renderCalendarDay() i could simply just set which modifiers i want for the rendering CalendarDay. Currently any custom modifiers are simply not applied.

Apparently this proposal was not very popular, so I am closing it. I no longer use react-dates and now I feel out of context.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Daniel15 picture Daniel15  路  3Comments

cemremengu picture cemremengu  路  3Comments

sag1v picture sag1v  路  3Comments

Adam-Pendleton picture Adam-Pendleton  路  3Comments

jpollard-cs picture jpollard-cs  路  3Comments