How do we disable certain days of the week?
How do we disable certain days of the week?
Like for example, say I want to disable Monday and Tuesday. (Not just weekends)
@pagesrichie https://reactdatepicker.com/#example-21
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
You may use filterDate props. refer https://reactdatepicker.com/#example-filter-dates. also you need to use date.getDay() instead of getDay(date)
() => {
const [startDate, setStartDate] = useState(null);
const isWeekday = (date) => {
const day = date.getDay();
return day !== 0 && day !== 6;
};
return (
<DatePicker
selected={startDate}
onChange={(date) => setStartDate(date)}
filterDate={isWeekday}
placeholderText="Select a weekday"
/>
);
};
thanks
Is there a way to exclude the days from appearing in the calendar, i.e. only display Mon-Fri?
Same question here, how can we exclude them and also hide them from the calendar?