An input field to enter and edit a date and time value, with configurable input and display formats.
- Element
-
igc-date-time-input
- 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"disabled
Section titled "disabled"Inherited from: EventEmitterMixin< IgcDateTimeInputComponentEventMap, typeof IgcDateTimeInputBaseComponent<Date, DatePart> >(IgcDateTimeInputBaseComponent)
Whether the control is disabled. A disabled control is not validated, and the form does not submit its value.
disabled: boolean Defined in src/internals/mixins/forms/types.ts:35
invalid
Section titled "invalid"Inherited from: EventEmitterMixin< IgcDateTimeInputComponentEventMap, typeof IgcDateTimeInputBaseComponent<Date, DatePart> >(IgcDateTimeInputBaseComponent)
Whether the control shows the invalid state. It changes only the visual state, not the validity.
invalid: boolean Defined in src/internals/mixins/forms/types.ts:43
label
Section titled "label"Inherited from: EventEmitterMixin< IgcDateTimeInputComponentEventMap, typeof IgcDateTimeInputBaseComponent<Date, DatePart> >(IgcDateTimeInputBaseComponent)
The label for the control.
label: string Defined in src/components/date-time-input/date-time-input.base.ts:167
Inherited from: EventEmitterMixin< IgcDateTimeInputComponentEventMap, typeof IgcDateTimeInputBaseComponent<Date, DatePart> >(IgcDateTimeInputBaseComponent)
The name of the control, submitted with the form data.
name: string Defined in src/internals/mixins/forms/types.ts:49
outlined
Section titled "outlined"Inherited from: EventEmitterMixin< IgcDateTimeInputComponentEventMap, typeof IgcDateTimeInputBaseComponent<Date, DatePart> >(IgcDateTimeInputBaseComponent)
Whether the control has an outlined appearance.
outlined: boolean = false Defined in src/components/date-time-input/date-time-input.base.ts:153
placeholder
Section titled "placeholder"Inherited from: EventEmitterMixin< IgcDateTimeInputComponentEventMap, typeof IgcDateTimeInputBaseComponent<Date, DatePart> >(IgcDateTimeInputBaseComponent)
The placeholder text of the control.
placeholder: string Defined in src/components/date-time-input/date-time-input.base.ts:160
readOnly
Section titled "readOnly"Inherited from: EventEmitterMixin< IgcDateTimeInputComponentEventMap, typeof IgcDateTimeInputBaseComponent<Date, DatePart> >(IgcDateTimeInputBaseComponent)
Whether the control is read-only. The user cannot change its value.
readOnly: boolean Defined in src/internals/mixins/mask-behavior.ts:103
Optional spinDelta
Section titled "spinDelta"Inherited from: EventEmitterMixin< IgcDateTimeInputComponentEventMap, typeof IgcDateTimeInputBaseComponent<Date, DatePart> >(IgcDateTimeInputBaseComponent)
The amount by which a step action increments or decrements each date part.
All values default to 1.
spinDelta: DatePartDeltas Defined in src/components/date-time-input/date-time-input.base.ts:236
spinLoop
Section titled "spinLoop"Inherited from: EventEmitterMixin< IgcDateTimeInputComponentEventMap, typeof IgcDateTimeInputBaseComponent<Date, DatePart> >(IgcDateTimeInputBaseComponent)
Whether a spun date part wraps around at its limits. When false, the part stops at its minimum or maximum.
spinLoop: boolean = true Defined in src/components/date-time-input/date-time-input.base.ts:244
tagName
Section titled "tagName"The tagName read-only property of the Element interface returns the tag name of the element on which it's called.
tagName: "igc-date-time-input" = 'igc-date-time-input' Defined in src/components/date-time-input/date-time-input.ts:79
Accessors
Section titled "Accessors"defaultValue
Section titled "defaultValue"Inherited from: EventEmitterMixin< IgcDateTimeInputComponentEventMap, typeof IgcDateTimeInputBaseComponent<Date, DatePart> >(IgcDateTimeInputBaseComponent)
get defaultValue(): any Defined in src/internals/mixins/forms/types.ts:158
The default value of the control. A form reset restores the value to it.
While the value is unchanged since the start or the last form reset, a new
default also sets the value. The value attribute also sets it.
set defaultValue(value: unknown): void Defined in src/internals/mixins/forms/types.ts:158
Parameters
- value:
unknown
Returns void
displayFormat
Section titled "displayFormat"Inherited from: EventEmitterMixin< IgcDateTimeInputComponentEventMap, typeof IgcDateTimeInputBaseComponent<Date, DatePart> >(IgcDateTimeInputBaseComponent)
get displayFormat(): any Defined in src/components/date-time-input/date-time-input.base.ts:221
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.
set displayFormat(value: string): void Defined in src/components/date-time-input/date-time-input.base.ts:221
Parameters
- value:
string
Returns void
Inherited from: EventEmitterMixin< IgcDateTimeInputComponentEventMap, typeof IgcDateTimeInputBaseComponent<Date, DatePart> >(IgcDateTimeInputBaseComponent)
The form that the control is associated with, or null.
get form(): HTMLFormElement | null Defined in src/internals/mixins/forms/types.ts:52
Returns HTMLFormElement | null
inputFormat
Section titled "inputFormat"Inherited from: EventEmitterMixin< IgcDateTimeInputComponentEventMap, typeof IgcDateTimeInputBaseComponent<Date, DatePart> >(IgcDateTimeInputBaseComponent)
The date format of the input while the user edits the value. Without it, the input uses the input format of the locale.
get inputFormat(): string Defined in src/components/date-time-input/date-time-input.base.ts:175
Returns string
locale
Section titled "locale"Inherited from: EventEmitterMixin< IgcDateTimeInputComponentEventMap, typeof IgcDateTimeInputBaseComponent<Date, DatePart> >(IgcDateTimeInputBaseComponent)
get locale(): any Defined in src/components/date-time-input/date-time-input.base.ts:253
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.
set locale(value: string): void Defined in src/components/date-time-input/date-time-input.base.ts:253
Parameters
- value:
string
Returns void
Inherited from: EventEmitterMixin< IgcDateTimeInputComponentEventMap, typeof IgcDateTimeInputBaseComponent<Date, DatePart> >(IgcDateTimeInputBaseComponent)
The mask pattern of the component.
get mask(): string Defined in src/internals/mixins/mask-behavior.ts:109
Returns string
Inherited from: EventEmitterMixin< IgcDateTimeInputComponentEventMap, typeof IgcDateTimeInputBaseComponent<Date, DatePart> >(IgcDateTimeInputBaseComponent)
get max(): any Defined in src/components/date-time-input/date-time-input.base.ts:206
The maximum value required for the input to remain valid.
set max(value: string | Date | null | undefined): void Defined in src/components/date-time-input/date-time-input.base.ts:206
Parameters
- value:
string | Date | null | undefined
Returns void
Inherited from: EventEmitterMixin< IgcDateTimeInputComponentEventMap, typeof IgcDateTimeInputBaseComponent<Date, DatePart> >(IgcDateTimeInputBaseComponent)
get min(): any Defined in src/components/date-time-input/date-time-input.base.ts:192
The minimum value required for the input to remain valid.
set min(value: string | Date | null | undefined): void Defined in src/components/date-time-input/date-time-input.base.ts:192
Parameters
- value:
string | Date | null | undefined
Returns void
prompt
Section titled "prompt"Inherited from: EventEmitterMixin< IgcDateTimeInputComponentEventMap, typeof IgcDateTimeInputBaseComponent<Date, DatePart> >(IgcDateTimeInputBaseComponent)
The prompt symbol for the unfilled parts of the mask pattern.
get prompt(): string Defined in src/internals/mixins/mask-behavior.ts:117
Returns string
required
Section titled "required"Inherited from: EventEmitterMixin< IgcDateTimeInputComponentEventMap, typeof IgcDateTimeInputBaseComponent<Date, DatePart> >(IgcDateTimeInputBaseComponent)
get required(): any Defined in src/internals/mixins/forms/types.ts:188
Whether the control is required. A required control that has no value, or is not checked, fails validation.
set required(value: boolean): void Defined in src/internals/mixins/forms/types.ts:188
Parameters
- value:
boolean
Returns void
selectionEnd
Section titled "selectionEnd"Inherited from: EventEmitterMixin< IgcDateTimeInputComponentEventMap, typeof IgcDateTimeInputBaseComponent<Date, DatePart> >(IgcDateTimeInputBaseComponent)
The offset of the end of the text selection, in UTF-16 code units.
get selectionEnd(): number Defined in src/internals/mixins/mask-behavior.ts:127
Returns number
selectionStart
Section titled "selectionStart"Inherited from: EventEmitterMixin< IgcDateTimeInputComponentEventMap, typeof IgcDateTimeInputBaseComponent<Date, DatePart> >(IgcDateTimeInputBaseComponent)
The offset of the start of the text selection, in UTF-16 code units.
Equals selectionEnd when no text is selected.
get selectionStart(): number Defined in src/internals/mixins/mask-behavior.ts:124
Returns number
validationMessage
Section titled "validationMessage"Inherited from: EventEmitterMixin< IgcDateTimeInputComponentEventMap, typeof IgcDateTimeInputBaseComponent<Date, DatePart> >(IgcDateTimeInputBaseComponent)
The validation message of the control. It is empty when the control is valid.
get validationMessage(): string Defined in src/internals/mixins/forms/types.ts:61
Returns string
validity
Section titled "validity"Inherited from: EventEmitterMixin< IgcDateTimeInputComponentEventMap, typeof IgcDateTimeInputBaseComponent<Date, DatePart> >(IgcDateTimeInputBaseComponent)
The validity state of the control.
get validity(): ValidityState Defined in src/internals/mixins/forms/types.ts:55
Returns ValidityState
value
Section titled "value"The committed value of the input.
get value(): Date | null Defined in src/components/date-time-input/date-time-input.ts:119
Returns Date | null
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.
set value(value: string | Date | null | undefined): void Defined in src/components/date-time-input/date-time-input.ts:115
Parameters
- value:
string | Date | null | undefined
Returns void
willValidate
Section titled "willValidate"Inherited from: EventEmitterMixin< IgcDateTimeInputComponentEventMap, typeof IgcDateTimeInputBaseComponent<Date, DatePart> >(IgcDateTimeInputBaseComponent)
Whether the control is a candidate for constraint validation.
get willValidate(): boolean Defined in src/internals/mixins/forms/types.ts:64
Returns boolean
Methods
Section titled "Methods"Inherited from: EventEmitterMixin< IgcDateTimeInputComponentEventMap, typeof IgcDateTimeInputBaseComponent<Date, DatePart> >(IgcDateTimeInputBaseComponent)
Removes focus from the control.
blur(): void Defined in src/components/date-time-input/date-time-input.base.ts:582
Returns void
checkValidity
Section titled "checkValidity"Inherited from: EventEmitterMixin< IgcDateTimeInputComponentEventMap, typeof IgcDateTimeInputBaseComponent<Date, DatePart> >(IgcDateTimeInputBaseComponent)
Checks validity and emits invalid when the control is invalid. Returns
true when the control is valid.
checkValidity(): boolean Defined in src/internals/mixins/forms/types.ts:134
Returns boolean
clear
Section titled "clear"Inherited from: EventEmitterMixin< IgcDateTimeInputComponentEventMap, typeof IgcDateTimeInputBaseComponent<Date, DatePart> >(IgcDateTimeInputBaseComponent)
Clears the value and the text of the input.
clear(): void Defined in src/components/date-time-input/date-time-input.base.ts:623
Returns void
focus
Section titled "focus"Inherited from: EventEmitterMixin< IgcDateTimeInputComponentEventMap, typeof IgcDateTimeInputBaseComponent<Date, DatePart> >(IgcDateTimeInputBaseComponent)
Sets focus on the control.
focus(options: FocusOptions): void Defined in src/components/date-time-input/date-time-input.base.ts:575
Parameters
- options:
FocusOptions
Returns void
hasDateParts
Section titled "hasDateParts"Inherited from: EventEmitterMixin< IgcDateTimeInputComponentEventMap, typeof IgcDateTimeInputBaseComponent<Date, DatePart> >(IgcDateTimeInputBaseComponent)
Returns whether the input format has a date part: day, month or year.
hasDateParts(): boolean Defined in src/components/date-time-input/date-time-input.base.ts:700
Returns boolean
hasTimeParts
Section titled "hasTimeParts"Inherited from: EventEmitterMixin< IgcDateTimeInputComponentEventMap, typeof IgcDateTimeInputBaseComponent<Date, DatePart> >(IgcDateTimeInputBaseComponent)
Returns whether the input format has a time part: hours, minutes or seconds.
hasTimeParts(): boolean Defined in src/components/date-time-input/date-time-input.base.ts:706
Returns boolean
reportValidity
Section titled "reportValidity"Inherited from: EventEmitterMixin< IgcDateTimeInputComponentEventMap, typeof IgcDateTimeInputBaseComponent<Date, DatePart> >(IgcDateTimeInputBaseComponent)
Checks validity. As for a native control, an invalid control emits
invalid and takes the focus. It shows its own validation messages, not
the message of the browser. Returns true when the control is valid.
reportValidity(): boolean Defined in src/internals/mixins/forms/types.ts:141
Returns boolean
select
Section titled "select"Inherited from: EventEmitterMixin< IgcDateTimeInputComponentEventMap, typeof IgcDateTimeInputBaseComponent<Date, DatePart> >(IgcDateTimeInputBaseComponent)
Selects all the text inside the input.
select(): void Defined in src/components/date-time-input/date-time-input.base.ts:569
Returns void
setCustomValidity
Section titled "setCustomValidity"Inherited from: EventEmitterMixin< IgcDateTimeInputComponentEventMap, typeof IgcDateTimeInputBaseComponent<Date, DatePart> >(IgcDateTimeInputBaseComponent)
Sets a custom validation message. The control is invalid while the message is not empty. An empty string removes the custom error.
setCustomValidity(message: string): void Defined in src/internals/mixins/forms/types.ts:147
Parameters
- message:
string
Returns void
setRangeText
Section titled "setRangeText"Inherited from: EventEmitterMixin< IgcDateTimeInputComponentEventMap, typeof IgcDateTimeInputBaseComponent<Date, DatePart> >(IgcDateTimeInputBaseComponent)
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 Defined in src/components/date-time-input/date-time-input.base.ts:612
Parameters
- replacement:
string - start:
number - end:
number - selectMode:
RangeTextSelectMode
Returns void
setSelectionRange
Section titled "setSelectionRange"Inherited from: EventEmitterMixin< IgcDateTimeInputComponentEventMap, typeof IgcDateTimeInputBaseComponent<Date, DatePart> >(IgcDateTimeInputBaseComponent)
Sets the text selection range of the control.
setSelectionRange(start: number, end: number, direction: SelectionRangeDirection): void Defined in src/internals/mixins/mask-behavior.ts:165
Parameters
- start:
number - end:
number - direction:
SelectionRangeDirection
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 Defined in src/components/date-time-input/date-time-input.ts:260
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: DatePart, delta: number): void Defined in src/components/date-time-input/date-time-input.ts:251
Parameters
- datePart:
DatePart - delta:
number