'How to disable dates in react-admin DateInput
Is there any attribute we can use to disable future dates in react admin Date Input filter.
<DateInput
source="name"
label="name"
alwaysOn
validate={getValidate(props)}
/>
Solution 1:[1]
React-admin uses html5 date input under the hood, so you can use the min and max attributes for that. See Restrict future dates in HTML5 date input.
Solution 2:[2]
we can pass as prop the property inputProps and send min and max
<DateTimeInput
source="end_time"
label="end_time"
fullWidth
inputProps={{
min: '2022-04-22T00:00',
max: '2022-04-28T00:00',
}}
/>
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Thiery Michel |
Solution 2 |