design-system-react
design-system-react copied to clipboard
Datepicker should accept minDate, maxDate props
Datepicker should accept minDate, maxDate props. Currently, we can not set minDate, maxDate value in the props.
minDate - The minimum date that the user can select. It will ensure that no earlier date is selected. maxDate - The maximum date that the user can select. It will ensure that no later date is selected.
Example - https://reactdatepicker.com/#example-specific-date-range
The components are meant to follow the SLDS design patterns according to their website it does not offer such functionality so I am not sure how they proceed with extra features.
You can use dateDisabled
to achieve that. For example the below will disable dates prior to current day, and additionally disable the current day if it's after 4pm:
<Datepicker
{...props} // etc
dateDisabled={({ date }) => {
const now = new Date();
date.setHours(16, 0, 0, 0);
return date < now;
}}
/>
This issue has been automatically marked as stale, because it has not had recent activity. It will be closed if no further activity occurs. Maintainers are responsible for tech debt and project health. This is most likely a new components or component feature request. Please submit a pull request for or request feedback on this feature. Thank you.