An input field to enter and edit a date and time value, with configurable input and display formats.
- Slots
-
prefix— Renders content before the input. -
suffix— Renders content after the input. -
helper-text— Renders content below the input. -
value-missing— Renders content when the required validation fails. -
range-overflow— Renders content when the max validation fails. -
range-underflow— Renders content when the min validation fails. -
custom-error— Renders content when a custom message is set with `setCustomValidity()`. -
invalid— Renders content when the component is in invalid state (validity.valid = false).
- CSS Parts
-
container— The main wrapper that holds all main input elements. -
input— The native input element. -
label— The native label element. -
prefix— The prefix wrapper. -
suffix— The suffix wrapper. -
helper-text— The helper text wrapper. -
prefixed— Added to the container and the input when an element that is not hidden is in the prefix slot. -
suffixed— Added to the container and the input when an element that is not hidden is in the suffix slot. -
filled— Added to the container and the input unless the focused input shows only the empty mask. -
labelled— Added to the container in the material theme when the control has a label. -
start— The wrapper of the prefix in the material theme. -
notch— The wrapper of the label in the material theme. -
filler— The outline segment between the notch and the end in the material theme. -
end— The wrapper of the suffix in the material theme.
Properties
Section titled "Properties"displayFormat
Section titled "displayFormat"The format of the value while the input does not have focus.
Without it, the input uses inputFormat when set, else the display format of the locale.
displayFormat: string inputFormat
Section titled "inputFormat"The date format of the input while the user edits the value. Without it, the input uses the input format of the locale.
inputFormat: string locale
Section titled "locale"The locale used to format the display value. Without it, the input takes
its own lang, else the locale of the nearest ancestor that has a
locale (a component) or a lang, and then the global locale.
locale: string outlined
Section titled "outlined"Whether the control has an outlined appearance.
outlined: boolean spinDelta
Section titled "spinDelta"The amount by which a step action increments or decrements each date part.
All values default to 1.
spinDelta: DatePartDeltas | undefined spinLoop
Section titled "spinLoop"Whether a spun date part wraps around at its limits. When false, the part stops at its minimum or maximum.
spinLoop: boolean value
Section titled "value"The value of the input.
Only ever holds a committed value. While the user is typing, the intermediate
state lives in the masked text and is committed - together with an igcChange
event - when the edit is committed on blur. Use the igcInput event to observe
the value as it is being typed.
value: Date | null Methods
Section titled "Methods"Removes focus from the control.
blur(): void Returns void
clear
Section titled "clear"Clears the value and the text of the input.
clear(): void Returns void
focus
Section titled "focus"Sets focus on the control.
focus(options: FocusOptions): void Parameters
- options:
FocusOptions
Returns void
hasDateParts
Section titled "hasDateParts"Returns whether the input format has a date part: day, month or year.
hasDateParts(): boolean Returns boolean
hasTimeParts
Section titled "hasTimeParts"Returns whether the input format has a time part: hours, minutes or seconds.
hasTimeParts(): boolean Returns boolean
select
Section titled "select"Selects all the text inside the input.
select(): void Returns void
setRangeText
Section titled "setRangeText"Replaces the text from start to end in the input and re-applies the mask.
Without start and end, replaces the selected text. The value updates at once.
setRangeText(replacement: string, start: number, end: number, selectMode: RangeTextSelectMode): void Parameters
- replacement:
string - start:
number - end:
number - selectMode:
RangeTextSelectMode
Returns void
stepDown
Section titled "stepDown"Decrements a date or time part by delta, or by its spinDelta value.
Without datePart, it changes the part at the cursor or a default part.
The value updates at once.
stepDown(datePart: DatePart, delta: number): void Parameters
- datePart:
DatePart - delta:
number
Returns void
stepDown
Section titled "stepDown"Decrements a date or time part by delta, or by its spinDelta value.
Without datePart, it changes the part at the cursor or a default part.
The value updates at once.
stepDown(datePart: P, delta: number): void Parameters
- datePart:
P - delta:
number
Returns void
stepUp
Section titled "stepUp"Increments a date or time part by delta, or by its spinDelta value.
Without datePart, it changes the part at the cursor or a default part.
The value updates at once.
stepUp(datePart: DatePart, delta: number): void Parameters
- datePart:
DatePart - delta:
number
Returns void
stepUp
Section titled "stepUp"Increments a date or time part by delta, or by its spinDelta value.
Without datePart, it changes the part at the cursor or a default part.
The value updates at once.
stepUp(datePart: P, delta: number): void Parameters
- datePart:
P - delta:
number
Returns void
Events
Section titled "Events"onChange
Section titled "onChange"Emitted on blur, when the committed value differs from the one the editor was focused with.
onChange(args: CustomEvent<Date | null>): void Parameters
- args:
CustomEvent<Date | null>
Returns void
onInput
Section titled "onInput"Emitted when the control input receives user input.
onInput(args: CustomEvent<string>): void Parameters
- args:
CustomEvent<string>