material-ui icon indicating copy to clipboard operation
material-ui copied to clipboard

[Datepicker] Add example with specific days disabled.

Open francescabarbazeni87 opened this issue 10 years ago • 3 comments

It could be useful to add a datepicker parameter in order to disable specific weekdays. Given an array from 0 to 6, where 0 is Sunday and 6 is Saturday, all the numbers in the range are enabled.

Something like: availableWeekdays: [1, 2, 3, 4, 5]

francescabarbazeni87 avatar Jan 26 '16 07:01 francescabarbazeni87

You can already do this via 'shouldDisableDate' right?

EugeneZ avatar Jan 26 '16 18:01 EugeneZ

Thanks @EugeneZ, we should probably add this to one of the examples.

@francescabarbazeni87 shouldDisableDate takes a function which is passed each Date in turn, and should return a bool depending on whether to disable that date.

It's a bit more flexible than the declarative approach, as you could have dates disabled that meet certain conditions (e.g. last Friday of the month), or based on external data (e.g. hotel availability).

mbrookes avatar Jan 26 '16 19:01 mbrookes

Ok, thanks!

francescabarbazeni87 avatar Feb 03 '16 11:02 francescabarbazeni87