I want to disabled every Saturday and Sunday on my react-calendar. So I used the tileDisabled function like this:
<Calendar
onChange={setDate}
value={date}
minDate={today}
tileDisabled={({ date, view }) =>
(view === "month" && date.getDay() === 0) || date.getDay() === 6
}
/>
This works in some cases, but when I press the month to select another one, some months are disabled, like october in this
Hope it might works for you.
<Calender tileDisabled={({date}) => [0, 6].includes(date.getDay())}
In turn it will disable the day number 6 and 0 which means saturday and sunday.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.