I have a problem, I can not make actual dates in the datepicker. I have an array of date strings in a state. I only need to put these dates in the datepicker so that only these dates are available for clicking, how can I do this?
Array dates:
An example of how I want to do
i have a default datePicker from MUI https://codesandbox.io/s/v0xqj0?file=/demo.js
I tried to use google, tried through renderday, but so far it did not work. The maximum that happened is, it's funny))
CodePudding user response:
You can use the props "shouldDisableDate" to disable certain dates and pass a function that will return true if the value is not in your array of dates.
You have an example in the documentation here: https://mui.com/x/react-date-pickers/date-picker/
I forked your codesandbox here is what you could do: https://codesandbox.io/s/hardcore-yonath-kvk59t?file=/demo.js:917-921