UseDateInputResult
Properties
Section titled “Properties”clear: () => void;Clear the whole field.
Returns
Section titled “Returns”void
clearSegment
Section titled “clearSegment”clearSegment: (segment) => void;Clear one segment.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
segment | DateSegment |
Returns
Section titled “Returns”void
complete
Section titled “complete”complete: boolean;Every segment filled in.
disabled
Section titled “disabled”disabled: boolean;focused
Section titled “focused”focused: | DateSegment | null;The segment that currently has focus.
focusSegment
Section titled “focusSegment”focusSegment: (segment) => void;Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
segment | DateSegment |
Returns
Section titled “Returns”void
handleBlur
Section titled “handleBlur”handleBlur: (event) => void;Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
event | FocusEvent<HTMLElement> |
Returns
Section titled “Returns”void
handleSegmentFocus
Section titled “handleSegmentFocus”handleSegmentFocus: (segment, event) => void;Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
segment | DateSegment |
event | FocusEvent<HTMLElement> |
Returns
Section titled “Returns”void
ids: object & Record<DateSegment, string>;Type Declaration
Section titled “Type Declaration”group: string;hidden
Section titled “hidden”hidden: string;max: string | undefined;min: string | undefined;Usable bounds after coercion — a min after max leaves both undefined.
months
Section titled “months”months: string[];Localised month names, for the month segment’s aria-valuetext.
moveFocus
Section titled “moveFocus”moveFocus: (from, delta) => void;Move focus by delta segments, clamped at the ends.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
from | DateSegment |
delta | number |
Returns
Section titled “Returns”void
order: DateSegment[];Just the segment types, in display order.
outOfRange
Section titled “outOfRange”outOfRange: boolean;Complete, but outside min/max.
parts: DateParts;What is currently typed, segment by segment.
pieces
Section titled “pieces”pieces: DatePiece[];The segments and separators for the locale, in display order.
rangeFor
Section titled “rangeFor”rangeFor: (segment) => object;Inclusive bounds for one segment, given what else is filled in.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
segment | DateSegment |
Returns
Section titled “Returns”object
max: number;min: number;readOnly
Section titled “readOnly”readOnly: boolean;segmentRefs
Section titled “segmentRefs”segmentRefs: object;Structural rather than RefObject: in @types/react 18 RefObject.current
is readonly, in 19 it is mutable. Declaring the shape keeps this assignable
under both, which matters because react >= 18 is a peer.
current
Section titled “current”current: Partial<Record<DateSegment, HTMLElement | null>>;setSegment
Section titled “setSegment”setSegment: (segment, next) => void;Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
segment | DateSegment |
next | number | null |
Returns
Section titled “Returns”void
step: (segment, delta) => void;Arrow-key stepping, wrapping at the ends.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
segment | DateSegment |
delta | number |
Returns
Section titled “Returns”void
typeDigit
Section titled “typeDigit”typeDigit: (segment, digit) => void;Feed one typed digit into a segment; auto-advances when it cannot take more.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
segment | DateSegment |
digit | string |
Returns
Section titled “Returns”void
value: string | null;YYYY-MM-DD when every segment is filled and the date is real, else null.