React-day-picker: Selecting multiple days

Created on 21 Oct 2016  路  4Comments  路  Source: gpbl/react-day-picker

Is it possible to somehow configure the component to be used as a multiple date picker? I'm not talking about a range picker, but instead you would click multiple separate dates and they would be selected. For example something like this:

screenshot 2016-10-21 13 40 09

Most helpful comment

I've added an example about how implement this.

All 4 comments

Add the clicked day to an array in your component state, then make sure the function passed to selectedDays returns true when the day is included in the array.

To know if a day is included, you can loop over that array using the isSameDay utility provided in DateUtils.

Great! Worked perfectly, thanks! Is there any plans on adding a onWeekdayClick method which could be used to for example select all the mondays in a month?

@magnusohlin i haven't planned such feature but if you are interested implementing it .... it should be straightforward to add a prop to the Weekdays.js component ! 馃憤

I've added an example about how implement this.

Was this page helpful?
0 / 5 - 0 ratings