summaryrefslogtreecommitdiff
path: root/components
diff options
context:
space:
mode:
Diffstat (limited to 'components')
-rw-r--r--components/ui/date-picker.tsx11
1 files changed, 10 insertions, 1 deletions
diff --git a/components/ui/date-picker.tsx b/components/ui/date-picker.tsx
index a88a8679..80ce6ea1 100644
--- a/components/ui/date-picker.tsx
+++ b/components/ui/date-picker.tsx
@@ -19,6 +19,8 @@ interface DatePickerProps {
disabled?: boolean
placeholder?: string
className?: string
+ minDate?: Date
+ maxDate?: Date
}
export function DatePicker({
@@ -27,6 +29,8 @@ export function DatePicker({
disabled = false,
placeholder = "날짜 선택",
className,
+ minDate,
+ maxDate,
}: DatePickerProps) {
// 내부 상태 관리와 외부 상태 관리를 모두 지원
const [internalDate, setInternalDate] = React.useState<Date | undefined>(date)
@@ -67,7 +71,12 @@ export function DatePicker({
selected={displayDate}
onSelect={handleSelect}
initialFocus
- disabled={disabled}
+ disabled={(date) => {
+ if (disabled) return true
+ if (minDate && date < minDate) return true
+ if (maxDate && date > maxDate) return true
+ return false
+ }}
/>
</PopoverContent>
</Popover>