Skip to content

Commit 9af1505

Browse files
committed
feat: add minValue prop to DatePicker to disable dates before threshold
1 parent 20db5d1 commit 9af1505

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/components/experimental/DatePicker/DatePicker.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ function DatePicker({
4545
errorMessage,
4646
value,
4747
defaultValue,
48+
minValue,
4849
...props
4950
}: DatePickerProps): ReactElement {
5051
const [isOpen, setIsOpen] = useState(false);
@@ -112,7 +113,12 @@ function DatePicker({
112113
shouldCloseOnInteractOutside={element => element !== triggerRef.current}
113114
>
114115
<FocusTrap>
115-
<Calendar selected={selectedDate} onSelect={handleCalendarChange} selectionType="single" />
116+
<Calendar
117+
selected={selectedDate}
118+
onSelect={handleCalendarChange}
119+
selectionType="single"
120+
disabled={[{ before: dateValueToDate(minValue) }]}
121+
/>
116122
</FocusTrap>
117123
</StyledPopover>
118124
</BaseDatePicker>

0 commit comments

Comments
 (0)