Material-ui datepickers, how can one disable certain multiple dates

Viewed 1794

I need to disable multiple dates for the calendar, not just past or future dates, some dates that i provide to the calendar. For example i want to disable, let's say 29 of june, 27 of june and 4 of july. I understand that you can pass it through shouldDisableDates, although im not so sure how to do this.

im getting dates in this format enter image description here

const disabledDates = () => {
console.log(exludedDates)
return moment(exludedDates[0].pickup_date);
};

that's the code, it gets data from the screenshot

1 Answers

shouldDisableDates accepts a function in which date is passed. You could create a function which accepts date as an argument and use that date as per your conditions and returns either true or false from the function. The returned value if true will disable date and vice-versa. I hope you understands and give it a try.

Related