道具

支柱类型默认描述
value{ start: Date | null; end: Date | null }Selected date-time range value
onChange(value: { start: Date | null; end: Date | null }) => voidCallback when value changes
timeTimeConfigTime panel configuration (applied to both start and end)
presetsDateRangePreset[]Predefined date range presets
maxDaysnumberMaximum days allowed in range (inclusive)
minDaysnumberMinimum days required in range (inclusive)
allowSingleDateInRangebooleantrue允许开始等于结束的范围
minDateDateMinimum selectable date
maxDateDateMaximum selectable date
localePartial<Locale>Custom locale configuration
initialMonthDateInitial displayed month
size"small" | "medium" | "large" | "x-large""medium"Component size
weekStartsOnWeekDay"sunday"一周的第一天
isDateUnavailable(date: Date) => booleanMark dates as disabled
displayFormatstringCustom display format
openbooleanControlled open state
initialOpenbooleanInitial open state (uncontrolled)
onOpenChange(open: boolean) => voidCallback when open state changes
requiredbooleanfalse禁用清除值
showOutsideDaysbooleanfalse显示相邻月份的天数
highlightDatesDate[]Dates to highlight
shouldCloseOnSelectbooleanfalse预设点击时自动确认
numberOfMonthsnumber2显示月数
captionLayout"buttons" | "dropdown""buttons"Caption navigation style
fromYearnumberStart year for dropdown
toYearnumberEnd year for dropdown
disablePastbooleanfalse禁用今天之前的日期
disableFuturebooleanfalse禁用今天之后的日期
inlinebooleanfalse内嵌显示日历(无弹出窗口)
namestringHidden input name for form submission (start date-time)
endNamestringHidden input name for end date-time (defaults to name-end)
placeholderstringTrigger placeholder text
hideHeaderbooleanfalse隐藏导航标题
hideFooterbooleanfalse隐藏操作页脚

TimeConfig

interface TimeConfig {
/** Time display precision. Defaults to "minute". */
precision?: "hour" | "minute" | "second";
/** 12-hour or 24-hour format. Defaults to "24". */
hourFormat?: "12" | "24";
/** Minute increment step. Defaults to 5. */
minuteStep?: 1 | 2 | 3 | 5 | 10 | 15 | 20 | 30;
/** Second increment step. Defaults to 1. */
secondStep?: 1 | 2 | 3 | 5 | 10 | 15 | 20 | 30;
/** Height (in px) of each scroll wheel item. Defaults to 32. */
itemHeight?: number;
}

DateRangePreset

interface DateRangePreset {
label: string;
value: { start: Date; end: Date } | (() => { start: Date; end: Date });
}