A date time input is an input field that lets you set and edit the date and time in a chosen input element using customizable display and input formats.
- Element
-
igc-date-time-input
- Slots
-
prefix— Renders content before the input. -
suffix— Renders content after 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 setCustomValidity(message) is set. -
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.
Properties
Section titled "Properties"disabled
Section titled "disabled"Inherited from: EventEmitterMixin< IgcDateTimeInputComponentEventMap, AbstractConstructor<IgcDateTimeInputBaseComponent<Date>> >(IgcDateTimeInputBaseComponent)
The disabled state of the component.
disabled: boolean Defined in src/internals/mixins/forms/types.ts:30
invalid
Section titled "invalid"Inherited from: EventEmitterMixin< IgcDateTimeInputComponentEventMap, AbstractConstructor<IgcDateTimeInputBaseComponent<Date>> >(IgcDateTimeInputBaseComponent)
Sets the control into invalid state (visual state only).
invalid: boolean Defined in src/internals/mixins/forms/types.ts:37
label
Section titled "label"Inherited from: EventEmitterMixin< IgcDateTimeInputComponentEventMap, AbstractConstructor<IgcDateTimeInputBaseComponent<Date>> >(IgcDateTimeInputBaseComponent)
The label for the control.
label: string Defined in src/components/date-time-input/date-time-input.base.ts:166
Inherited from: EventEmitterMixin< IgcDateTimeInputComponentEventMap, AbstractConstructor<IgcDateTimeInputBaseComponent<Date>> >(IgcDateTimeInputBaseComponent)
The name of the control, submitted with the form data.
name: string Defined in src/internals/mixins/forms/types.ts:43
outlined
Section titled "outlined"Inherited from: EventEmitterMixin< IgcDateTimeInputComponentEventMap, AbstractConstructor<IgcDateTimeInputBaseComponent<Date>> >(IgcDateTimeInputBaseComponent)
Whether the control will have outlined appearance.
outlined: boolean = false Defined in src/components/date-time-input/date-time-input.base.ts:152
placeholder
Section titled "placeholder"Inherited from: EventEmitterMixin< IgcDateTimeInputComponentEventMap, AbstractConstructor<IgcDateTimeInputBaseComponent<Date>> >(IgcDateTimeInputBaseComponent)
The placeholder text of the control.
placeholder: string Defined in src/components/date-time-input/date-time-input.base.ts:159
readOnly
Section titled "readOnly"Inherited from: EventEmitterMixin< IgcDateTimeInputComponentEventMap, AbstractConstructor<IgcDateTimeInputBaseComponent<Date>> >(IgcDateTimeInputBaseComponent)
Makes the control a readonly field.
readOnly: boolean Defined in src/internals/mixins/mask-behavior.ts:83
Optional spinDelta
Section titled "spinDelta"Inherited from: EventEmitterMixin< IgcDateTimeInputComponentEventMap, AbstractConstructor<IgcDateTimeInputBaseComponent<Date>> >(IgcDateTimeInputBaseComponent)
Delta values used to increment or decrement each date part on step actions.
All values default to 1.
spinDelta: DatePartDeltas Defined in src/components/date-time-input/date-time-input.base.ts:234
spinLoop
Section titled "spinLoop"Inherited from: EventEmitterMixin< IgcDateTimeInputComponentEventMap, AbstractConstructor<IgcDateTimeInputBaseComponent<Date>> >(IgcDateTimeInputBaseComponent)
Sets whether to loop over the currently spun segment.
spinLoop: boolean = true Defined in src/components/date-time-input/date-time-input.base.ts:241
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:66
Accessors
Section titled "Accessors"defaultValue
Section titled "defaultValue"Inherited from: EventEmitterMixin< IgcDateTimeInputComponentEventMap, AbstractConstructor<IgcDateTimeInputBaseComponent<Date>> >(IgcDateTimeInputBaseComponent)
get defaultValue(): any Defined in src/internals/mixins/forms/types.ts:182
The initial value of the component.
set defaultValue(value: unknown): void Defined in src/internals/mixins/forms/types.ts:182
Parameters
- value:
unknown
Returns void
displayFormat
Section titled "displayFormat"Inherited from: EventEmitterMixin< IgcDateTimeInputComponentEventMap, AbstractConstructor<IgcDateTimeInputBaseComponent<Date>> >(IgcDateTimeInputBaseComponent)
get displayFormat(): any Defined in src/components/date-time-input/date-time-input.base.ts:219
Format to display the value in when not editing. Defaults to the locale format if not set.
set displayFormat(value: string): void Defined in src/components/date-time-input/date-time-input.base.ts:219
Parameters
- value:
string
Returns void
Inherited from: EventEmitterMixin< IgcDateTimeInputComponentEventMap, AbstractConstructor<IgcDateTimeInputBaseComponent<Date>> >(IgcDateTimeInputBaseComponent)
Returns the HTMLFormElement associated with this element.
get form(): HTMLFormElement | null Defined in src/internals/mixins/forms/types.ts:46
Returns HTMLFormElement | null
inputFormat
Section titled "inputFormat"Inherited from: EventEmitterMixin< IgcDateTimeInputComponentEventMap, AbstractConstructor<IgcDateTimeInputBaseComponent<Date>> >(IgcDateTimeInputBaseComponent)
The date format to apply on the input.
get inputFormat(): string Defined in src/components/date-time-input/date-time-input.base.ts:173
Returns string
locale
Section titled "locale"Inherited from: EventEmitterMixin< IgcDateTimeInputComponentEventMap, AbstractConstructor<IgcDateTimeInputBaseComponent<Date>> >(IgcDateTimeInputBaseComponent)
get locale(): any Defined in src/components/date-time-input/date-time-input.base.ts:249
The locale used to format the display value and to resolve the component's resource strings. Falls back to the global locale when not set.
set locale(value: string): void Defined in src/components/date-time-input/date-time-input.base.ts:249
Parameters
- value:
string
Returns void
Inherited from: EventEmitterMixin< IgcDateTimeInputComponentEventMap, AbstractConstructor<IgcDateTimeInputBaseComponent<Date>> >(IgcDateTimeInputBaseComponent)
The mask pattern of the component.
get mask(): string Defined in src/internals/mixins/mask-behavior.ts:89
Returns string
Inherited from: EventEmitterMixin< IgcDateTimeInputComponentEventMap, AbstractConstructor<IgcDateTimeInputBaseComponent<Date>> >(IgcDateTimeInputBaseComponent)
get max(): any Defined in src/components/date-time-input/date-time-input.base.ts:204
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:204
Parameters
- value:
string | Date | null | undefined
Returns void
Inherited from: EventEmitterMixin< IgcDateTimeInputComponentEventMap, AbstractConstructor<IgcDateTimeInputBaseComponent<Date>> >(IgcDateTimeInputBaseComponent)
get min(): any Defined in src/components/date-time-input/date-time-input.base.ts:190
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:190
Parameters
- value:
string | Date | null | undefined
Returns void
prompt
Section titled "prompt"Inherited from: EventEmitterMixin< IgcDateTimeInputComponentEventMap, AbstractConstructor<IgcDateTimeInputBaseComponent<Date>> >(IgcDateTimeInputBaseComponent)
The prompt symbol to use for unfilled parts of the mask pattern.
get prompt(): string Defined in src/internals/mixins/mask-behavior.ts:97
Returns string
required
Section titled "required"Inherited from: EventEmitterMixin< IgcDateTimeInputComponentEventMap, AbstractConstructor<IgcDateTimeInputBaseComponent<Date>> >(IgcDateTimeInputBaseComponent)
get required(): any Defined in src/internals/mixins/forms/types.ts:207
When set, makes the component a required field for validation.
set required(value: boolean): void Defined in src/internals/mixins/forms/types.ts:207
Parameters
- value:
boolean
Returns void
validationMessage
Section titled "validationMessage"Inherited from: EventEmitterMixin< IgcDateTimeInputComponentEventMap, AbstractConstructor<IgcDateTimeInputBaseComponent<Date>> >(IgcDateTimeInputBaseComponent)
A string containing the validation message of this element.
get validationMessage(): string Defined in src/internals/mixins/forms/types.ts:55
Returns string
validity
Section titled "validity"Inherited from: EventEmitterMixin< IgcDateTimeInputComponentEventMap, AbstractConstructor<IgcDateTimeInputBaseComponent<Date>> >(IgcDateTimeInputBaseComponent)
Returns a ValidityState object which represents the different validity states the element can be in, with respect to constraint validation.
get validity(): ValidityState Defined in src/internals/mixins/forms/types.ts:52
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:110
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:106
Parameters
- value:
string | Date | null | undefined
Returns void
willValidate
Section titled "willValidate"Inherited from: EventEmitterMixin< IgcDateTimeInputComponentEventMap, AbstractConstructor<IgcDateTimeInputBaseComponent<Date>> >(IgcDateTimeInputBaseComponent)
A boolean value which returns true if the element is a submittable element that is a candidate for constraint validation.
get willValidate(): boolean Defined in src/internals/mixins/forms/types.ts:61
Returns boolean
Methods
Section titled "Methods"Inherited from: EventEmitterMixin< IgcDateTimeInputComponentEventMap, AbstractConstructor<IgcDateTimeInputBaseComponent<Date>> >(IgcDateTimeInputBaseComponent)
Removes focus from the control.
blur(): void Defined in src/components/date-time-input/date-time-input.base.ts:594
Returns void
checkValidity
Section titled "checkValidity"Inherited from: EventEmitterMixin< IgcDateTimeInputComponentEventMap, AbstractConstructor<IgcDateTimeInputBaseComponent<Date>> >(IgcDateTimeInputBaseComponent)
Checks for validity of the control and emits the invalid event if it's invalid.
checkValidity(): boolean Defined in src/internals/mixins/forms/types.ts:166
Returns boolean
clear
Section titled "clear"Inherited from: EventEmitterMixin< IgcDateTimeInputComponentEventMap, AbstractConstructor<IgcDateTimeInputBaseComponent<Date>> >(IgcDateTimeInputBaseComponent)
Clears the input element of user input.
clear(): void Defined in src/components/date-time-input/date-time-input.base.ts:623
Returns void
emitEvent
Section titled "emitEvent"Inherited from: EventEmitterMixin< IgcDateTimeInputComponentEventMap, AbstractConstructor<IgcDateTimeInputBaseComponent<Date>> >(IgcDateTimeInputBaseComponent)
Provided by EventEmitterMixin in the concrete components.
emitEvent(name: string, init: CustomEventInit<any>): boolean Defined in src/components/date-time-input/date-time-input.base.ts:680
Parameters
- name:
string - init:
CustomEventInit<any>
Returns boolean
focus
Section titled "focus"Inherited from: EventEmitterMixin< IgcDateTimeInputComponentEventMap, AbstractConstructor<IgcDateTimeInputBaseComponent<Date>> >(IgcDateTimeInputBaseComponent)
Sets focus on the control.
focus(options: FocusOptions): void Defined in src/components/date-time-input/date-time-input.base.ts:588
Parameters
- options:
FocusOptions
Returns void
hasDateParts
Section titled "hasDateParts"Checks whether the current format includes date parts (day, month, year).
hasDateParts(): boolean Defined in src/components/date-time-input/date-time-input.ts:287
Returns boolean
hasTimeParts
Section titled "hasTimeParts"Checks whether the current format includes time parts (hours, minutes, seconds).
hasTimeParts(): boolean Defined in src/components/date-time-input/date-time-input.ts:296
Returns boolean
reportValidity
Section titled "reportValidity"Inherited from: EventEmitterMixin< IgcDateTimeInputComponentEventMap, AbstractConstructor<IgcDateTimeInputBaseComponent<Date>> >(IgcDateTimeInputBaseComponent)
Checks for validity of the control and shows the browser message if it's invalid.
reportValidity(): boolean Defined in src/internals/mixins/forms/types.ts:169
Returns boolean
select
Section titled "select"Inherited from: EventEmitterMixin< IgcDateTimeInputComponentEventMap, AbstractConstructor<IgcDateTimeInputBaseComponent<Date>> >(IgcDateTimeInputBaseComponent)
Selects all the text inside the input.
select(): void Defined in src/components/date-time-input/date-time-input.base.ts:582
Returns void
setCustomValidity
Section titled "setCustomValidity"Inherited from: EventEmitterMixin< IgcDateTimeInputComponentEventMap, AbstractConstructor<IgcDateTimeInputBaseComponent<Date>> >(IgcDateTimeInputBaseComponent)
Sets a custom validation message for the control.
As long as message is not empty, the control is considered invalid.
setCustomValidity(message: string): void Defined in src/internals/mixins/forms/types.ts:175
Parameters
- message:
string
Returns void
setRangeText
Section titled "setRangeText"Inherited from: EventEmitterMixin< IgcDateTimeInputComponentEventMap, AbstractConstructor<IgcDateTimeInputBaseComponent<Date>> >(IgcDateTimeInputBaseComponent)
Replaces the selected text in the control and re-applies the mask.
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, AbstractConstructor<IgcDateTimeInputBaseComponent<Date>> >(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:133
Parameters
- start:
number - end:
number - direction:
SelectionRangeDirection
Returns void
stepDown
Section titled "stepDown"Decrements a date/time portion.
stepDown(datePart: DatePart, delta: number): void Defined in src/components/date-time-input/date-time-input.ts:278
Parameters
- datePart:
DatePart - delta:
number
Returns void
stepUp
Section titled "stepUp"Increments a date/time portion.
stepUp(datePart: DatePart, delta: number): void Defined in src/components/date-time-input/date-time-input.ts:273
Parameters
- datePart:
DatePart - delta:
number