class sap.m.DateTimeInput

Control sample: sap.m.DateTimeInput
Visiblity: public
UX Guidelines:
Implements:
Available since: N/A
Module: sap/m/DateTimeInput
Application Component: CA-UI5-CTR

Allows end users to interact with date (between 0001-01-01 and 9999-12-31) and/or time and select from a date and/or time pad.

Note: This control should not be used any longer, instead please use the dedicated sap.m.DatePicker, sap.m.TimePicker or sap.m.DateTimePicker control.


Constructor

Constructor for a new DateTimeInput.

Accepts an object literal mSettings that defines initial property values, aggregated and associated objects as well as event handlers. See sap.ui.base.ManagedObject#constructor for a general description of the syntax of the settings object.

new sap.m.DateTimeInput(sId?, mSettings?)
Param Type Default Value Description
sId? string

ID for the new control, generated automatically if no ID is given

mSettings? object

Initial settings for the new control


Properties

Name Type Default Value Description
dateValue object

This property as JavaScript Date Object can be used to assign a new value which is independent from valueFormat.

Visibility: public
displayFormat string

Displays date value in this given format in text field. Default value is taken from locale settings. If you use data-binding on value property with type sap.ui.model.type.Date then you can ignore this property or the latter wins. If the user's browser supports native picker then this property is overwritten by browser with locale settings.

Visibility: public
editable boolean true

Defines whether the control can be modified by the user or not. Note: A user can tab to non-editable control, highlight it, and copy the text from it.

Since: 1.12.0.

Visibility: public
enabled boolean true

Indicates whether the user can interact with the control or not. Note: Disabled controls cannot be focused and they are out of the tab-chain.

Visibility: public
name string

Defines the name of the control for the purposes of form submission.

Visibility: public
placeholder string

Defines a short hint intended to aid the user with data entry when the control has no value.

Visibility: public
showValueStateMessage boolean true

Indicates whether the value state message should be shown or not.

Since: 1.26.0.

Visibility: public
textAlign sap.ui.core.TextAlign Initial

Defines the horizontal alignment of the text that is shown inside the input field.

Since: 1.26.0.

Visibility: public
textDirection sap.ui.core.TextDirection Inherit

Defines the text directionality of the input field, e.g. RTL, LTR

Since: 1.28.0.

Visibility: public
type sap.m.DateTimeInputType Date

Type of DateTimeInput (e.g. Date, Time, DateTime)

Visibility: public
value string

Defines the value of the control.

The new value must be in the format set by valueFormat.

The "Now" literal can also be assigned as a parameter to show the current date and/or time.

Visibility: public
valueFormat string

Given value property should match with valueFormat to parse date. Default value is taken from locale settings. You can only set and get value in this format. If you use data-binding on value property with type sap.ui.model.type.Date you can ignore this property or the latter wins.

Visibility: public
valueState sap.ui.core.ValueState None

Visualizes the validation state of the control, e.g. Error, Warning, Success.

Visibility: public
valueStateText string

Defines the text that appears in the value state message pop-up. If this is not specified, a default text is shown from the resource bundle.

Since: 1.26.0.

Visibility: public
width sap.ui.core.CSSSize 100%

Defines the width of the control.

Visibility: public

Aggregations

Default Aggregation:

Name Cardinality Type Description
_picker 0..1 sap.ui.core.Control

Associations

Name Cardinality Type Description
ariaLabelledBy 0..n sap.ui.core.Control

Association to controls / IDs that label this control (see WAI-ARIA attribute aria-labelledby).

Since: 1.27.0.


Events Overview

Event Description
change

This event gets fired when the selection has finished and the value has changed.

change

This event gets fired when the selection has finished and the value has changed.

Param Type Description
oControlEvent sap.ui.base.Event
getSource sap.ui.base.EventProvider
getParameters object
value string

The string value of the control in given valueFormat (or locale format).

dateValue object

The value of control as JavaScript Date Object or null if value is empty.

valid boolean

if set, the entered value is a valid date. If not set the entered value cannot be converted to a date.

Since: 1.38.0.


Methods Overview

Method Description
addAriaLabelledBy

Adds some ariaLabelledBy into the association ariaLabelledBy.

attachChange

Attaches event handler fnFunction to the change event of this sap.m.DateTimeInput.

When called, the context of the event handler (its this) will be bound to oListener if specified, otherwise it will be bound to this sap.m.DateTimeInput itself.

This event gets fired when the selection has finished and the value has changed.

bindValue

Binds property value to model data.

See ManagedObject.bindProperty for a detailed description of the possible properties of oBindingInfo

detachChange

Detaches event handler fnFunction from the change event of this sap.m.DateTimeInput.

The passed function and listener object must match the ones used for event registration.

sap.m.DateTimeInput.extend

Creates a new subclass of class sap.m.DateTimeInput with name sClassName and enriches it with the information contained in oClassInfo.

oClassInfo might contain the same kind of information as described in sap.ui.core.Control.extend.

fireChange

Fires event change to attached listeners.

getAccessibilityInfo

References:

  • sap.ui.core.Control#getAccessibilityInfo

getAriaLabelledBy

Returns array of IDs of the elements which are the current targets of the association ariaLabelledBy.

getDateValue

Gets current value of property dateValue.

This property as JavaScript Date Object can be used to assign a new value which is independent from valueFormat.

getDisplayFormat

Gets current value of property displayFormat.

Displays date value in this given format in text field. Default value is taken from locale settings. If you use data-binding on value property with type sap.ui.model.type.Date then you can ignore this property or the latter wins. If the user's browser supports native picker then this property is overwritten by browser with locale settings.

getEditable

Gets current value of property editable.

Defines whether the control can be modified by the user or not. Note: A user can tab to non-editable control, highlight it, and copy the text from it.

Default value is true.

getEnabled

Gets current value of property enabled.

Indicates whether the user can interact with the control or not. Note: Disabled controls cannot be focused and they are out of the tab-chain.

Default value is true.

sap.m.DateTimeInput.getMetadata

Returns a metadata object for class sap.m.DateTimeInput.

getName

Gets current value of property name.

Defines the name of the control for the purposes of form submission.

getPlaceholder

Gets current value of property placeholder.

Defines a short hint intended to aid the user with data entry when the control has no value.

getShowValueStateMessage

Gets current value of property showValueStateMessage.

Indicates whether the value state message should be shown or not.

Default value is true.

getTextAlign

Gets current value of property textAlign.

Defines the horizontal alignment of the text that is shown inside the input field.

Default value is Initial.

getTextDirection

Gets current value of property textDirection.

Defines the text directionality of the input field, e.g. RTL, LTR

Default value is Inherit.

getType

Gets current value of property type.

Type of DateTimeInput (e.g. Date, Time, DateTime)

Default value is Date.

getValue

Gets current value of property value.

Defines the value of the control.

The new value must be in the format set by valueFormat.

The "Now" literal can also be assigned as a parameter to show the current date and/or time.

getValueFormat

Gets current value of property valueFormat.

Given value property should match with valueFormat to parse date. Default value is taken from locale settings. You can only set and get value in this format. If you use data-binding on value property with type sap.ui.model.type.Date you can ignore this property or the latter wins.

getValueState

Gets current value of property valueState.

Visualizes the validation state of the control, e.g. Error, Warning, Success.

Default value is None.

getValueStateText

Gets current value of property valueStateText.

Defines the text that appears in the value state message pop-up. If this is not specified, a default text is shown from the resource bundle.

getWidth

Gets current value of property width.

Defines the width of the control.

Default value is "100%".

removeAllAriaLabelledBy

Removes all the controls in the association named ariaLabelledBy.

removeAriaLabelledBy

Removes an ariaLabelledBy from the association named ariaLabelledBy.

setDateValue

Sets a new value for property dateValue.

This property as JavaScript Date Object can be used to assign a new value which is independent from valueFormat.

When called with a value of null or undefined, the default value of the property will be restored.

setDisplayFormat

Sets a new value for property displayFormat.

Displays date value in this given format in text field. Default value is taken from locale settings. If you use data-binding on value property with type sap.ui.model.type.Date then you can ignore this property or the latter wins. If the user's browser supports native picker then this property is overwritten by browser with locale settings.

When called with a value of null or undefined, the default value of the property will be restored.

setEditable

Sets a new value for property editable.

Defines whether the control can be modified by the user or not. Note: A user can tab to non-editable control, highlight it, and copy the text from it.

When called with a value of null or undefined, the default value of the property will be restored.

Default value is true.

setEnabled

Sets a new value for property enabled.

Indicates whether the user can interact with the control or not. Note: Disabled controls cannot be focused and they are out of the tab-chain.

When called with a value of null or undefined, the default value of the property will be restored.

Default value is true.

setName

Sets a new value for property name.

Defines the name of the control for the purposes of form submission.

When called with a value of null or undefined, the default value of the property will be restored.

setPlaceholder

Sets a new value for property placeholder.

Defines a short hint intended to aid the user with data entry when the control has no value.

When called with a value of null or undefined, the default value of the property will be restored.

setShowValueStateMessage

Sets a new value for property showValueStateMessage.

Indicates whether the value state message should be shown or not.

When called with a value of null or undefined, the default value of the property will be restored.

Default value is true.

setTextAlign

Sets a new value for property textAlign.

Defines the horizontal alignment of the text that is shown inside the input field.

When called with a value of null or undefined, the default value of the property will be restored.

Default value is Initial.

setTextDirection

Sets a new value for property textDirection.

Defines the text directionality of the input field, e.g. RTL, LTR

When called with a value of null or undefined, the default value of the property will be restored.

Default value is Inherit.

setType

Sets a new value for property type.

Type of DateTimeInput (e.g. Date, Time, DateTime)

When called with a value of null or undefined, the default value of the property will be restored.

Default value is Date.

setValue

Sets a new value for property value.

Defines the value of the control.

The new value must be in the format set by valueFormat.

The "Now" literal can also be assigned as a parameter to show the current date and/or time.

When called with a value of null or undefined, the default value of the property will be restored.

setValueFormat

Sets a new value for property valueFormat.

Given value property should match with valueFormat to parse date. Default value is taken from locale settings. You can only set and get value in this format. If you use data-binding on value property with type sap.ui.model.type.Date you can ignore this property or the latter wins.

When called with a value of null or undefined, the default value of the property will be restored.

setValueState

Sets a new value for property valueState.

Visualizes the validation state of the control, e.g. Error, Warning, Success.

When called with a value of null or undefined, the default value of the property will be restored.

Default value is None.

setValueStateText

Sets a new value for property valueStateText.

Defines the text that appears in the value state message pop-up. If this is not specified, a default text is shown from the resource bundle.

When called with a value of null or undefined, the default value of the property will be restored.

setWidth

Sets a new value for property width.

Defines the width of the control.

When called with a value of null or undefined, the default value of the property will be restored.

Default value is "100%".

unbindValue

Unbinds property value from model data.

addAriaLabelledBy

Adds some ariaLabelledBy into the association ariaLabelledBy.

Param Type DefaultValue Description
vAriaLabelledBy sap.ui.core.ID sap.ui.core.Control

The ariaLabelledBy to add; if empty, nothing is inserted

attachChange

Attaches event handler fnFunction to the change event of this sap.m.DateTimeInput.

When called, the context of the event handler (its this) will be bound to oListener if specified, otherwise it will be bound to this sap.m.DateTimeInput itself.

This event gets fired when the selection has finished and the value has changed.

Param Type DefaultValue Description
oData object

An application-specific payload object that will be passed to the event handler along with the event object when firing the event

fnFunction function(sap.ui.base.Event) : void

The function to be called when the event occurs

oListener object

Context object to call the event handler with. Defaults to this sap.m.DateTimeInput itself

bindValue

Binds property value to model data.

See ManagedObject.bindProperty for a detailed description of the possible properties of oBindingInfo

Param Type DefaultValue Description
oBindingInfo sap.ui.base.ManagedObject.PropertyBindingInfo

The binding information

detachChange

Detaches event handler fnFunction from the change event of this sap.m.DateTimeInput.

The passed function and listener object must match the ones used for event registration.

Param Type DefaultValue Description
fnFunction function(sap.ui.base.Event) : void

The function to be called, when the event occurs

oListener object

Context object on which the given function had to be called

sap.m.DateTimeInput.extend

Creates a new subclass of class sap.m.DateTimeInput with name sClassName and enriches it with the information contained in oClassInfo.

oClassInfo might contain the same kind of information as described in sap.ui.core.Control.extend.

Param Type DefaultValue Description
sClassName string

Name of the class being created

oClassInfo object

Object literal with information about the class

FNMetaImpl function

Constructor function for the metadata object; if not given, it defaults to the metadata implementation used by this class

fireChange

Fires event change to attached listeners.

Param Type DefaultValue Description
mParameters object

Parameters to pass along with the event

value string

The string value of the control in given valueFormat (or locale format).

dateValue object

The value of control as JavaScript Date Object or null if value is empty.

valid boolean

if set, the entered value is a valid date. If not set the entered value cannot be converted to a date.

getAccessibilityInfo

References:

getAriaLabelledBy

Returns array of IDs of the elements which are the current targets of the association ariaLabelledBy.

getDateValue

Gets current value of property dateValue.

This property as JavaScript Date Object can be used to assign a new value which is independent from valueFormat.

getDisplayFormat

Gets current value of property displayFormat.

Displays date value in this given format in text field. Default value is taken from locale settings. If you use data-binding on value property with type sap.ui.model.type.Date then you can ignore this property or the latter wins. If the user's browser supports native picker then this property is overwritten by browser with locale settings.

getEditable

Gets current value of property editable.

Defines whether the control can be modified by the user or not. Note: A user can tab to non-editable control, highlight it, and copy the text from it.

Default value is true.

getEnabled

Gets current value of property enabled.

Indicates whether the user can interact with the control or not. Note: Disabled controls cannot be focused and they are out of the tab-chain.

Default value is true.

sap.m.DateTimeInput.getMetadata

Returns a metadata object for class sap.m.DateTimeInput.

getName

Gets current value of property name.

Defines the name of the control for the purposes of form submission.

getPlaceholder

Gets current value of property placeholder.

Defines a short hint intended to aid the user with data entry when the control has no value.

getShowValueStateMessage

Gets current value of property showValueStateMessage.

Indicates whether the value state message should be shown or not.

Default value is true.

getTextAlign

Gets current value of property textAlign.

Defines the horizontal alignment of the text that is shown inside the input field.

Default value is Initial.

getTextDirection

Gets current value of property textDirection.

Defines the text directionality of the input field, e.g. RTL, LTR

Default value is Inherit.

getType

Gets current value of property type.

Type of DateTimeInput (e.g. Date, Time, DateTime)

Default value is Date.

getValue

Gets current value of property value.

Defines the value of the control.

The new value must be in the format set by valueFormat.

The "Now" literal can also be assigned as a parameter to show the current date and/or time.

getValueFormat

Gets current value of property valueFormat.

Given value property should match with valueFormat to parse date. Default value is taken from locale settings. You can only set and get value in this format. If you use data-binding on value property with type sap.ui.model.type.Date you can ignore this property or the latter wins.

getValueState

Gets current value of property valueState.

Visualizes the validation state of the control, e.g. Error, Warning, Success.

Default value is None.

getValueStateText

Gets current value of property valueStateText.

Defines the text that appears in the value state message pop-up. If this is not specified, a default text is shown from the resource bundle.

getWidth

Gets current value of property width.

Defines the width of the control.

Default value is "100%".

removeAllAriaLabelledBy

Removes all the controls in the association named ariaLabelledBy.

removeAriaLabelledBy

Removes an ariaLabelledBy from the association named ariaLabelledBy.

Param Type DefaultValue Description
vAriaLabelledBy int sap.ui.core.ID sap.ui.core.Control

The ariaLabelledBy to be removed or its index or ID

setDateValue

Sets a new value for property dateValue.

This property as JavaScript Date Object can be used to assign a new value which is independent from valueFormat.

When called with a value of null or undefined, the default value of the property will be restored.

Param Type DefaultValue Description
oDateValue object

New value for property dateValue

setDisplayFormat

Sets a new value for property displayFormat.

Displays date value in this given format in text field. Default value is taken from locale settings. If you use data-binding on value property with type sap.ui.model.type.Date then you can ignore this property or the latter wins. If the user's browser supports native picker then this property is overwritten by browser with locale settings.

When called with a value of null or undefined, the default value of the property will be restored.

Param Type DefaultValue Description
sDisplayFormat string

New value for property displayFormat

setEditable

Sets a new value for property editable.

Defines whether the control can be modified by the user or not. Note: A user can tab to non-editable control, highlight it, and copy the text from it.

When called with a value of null or undefined, the default value of the property will be restored.

Default value is true.

Param Type DefaultValue Description
bEditable boolean true

New value for property editable

setEnabled

Sets a new value for property enabled.

Indicates whether the user can interact with the control or not. Note: Disabled controls cannot be focused and they are out of the tab-chain.

When called with a value of null or undefined, the default value of the property will be restored.

Default value is true.

Param Type DefaultValue Description
bEnabled boolean true

New value for property enabled

setName

Sets a new value for property name.

Defines the name of the control for the purposes of form submission.

When called with a value of null or undefined, the default value of the property will be restored.

Param Type DefaultValue Description
sName string

New value for property name

setPlaceholder

Sets a new value for property placeholder.

Defines a short hint intended to aid the user with data entry when the control has no value.

When called with a value of null or undefined, the default value of the property will be restored.

Param Type DefaultValue Description
sPlaceholder string

New value for property placeholder

setShowValueStateMessage

Sets a new value for property showValueStateMessage.

Indicates whether the value state message should be shown or not.

When called with a value of null or undefined, the default value of the property will be restored.

Default value is true.

Param Type DefaultValue Description
bShowValueStateMessage boolean true

New value for property showValueStateMessage

setTextAlign

Sets a new value for property textAlign.

Defines the horizontal alignment of the text that is shown inside the input field.

When called with a value of null or undefined, the default value of the property will be restored.

Default value is Initial.

Param Type DefaultValue Description
sTextAlign sap.ui.core.TextAlign Initial

New value for property textAlign

setTextDirection

Sets a new value for property textDirection.

Defines the text directionality of the input field, e.g. RTL, LTR

When called with a value of null or undefined, the default value of the property will be restored.

Default value is Inherit.

Param Type DefaultValue Description
sTextDirection sap.ui.core.TextDirection Inherit

New value for property textDirection

setType

Sets a new value for property type.

Type of DateTimeInput (e.g. Date, Time, DateTime)

When called with a value of null or undefined, the default value of the property will be restored.

Default value is Date.

Param Type DefaultValue Description
sType sap.m.DateTimeInputType Date

New value for property type

setValue

Sets a new value for property value.

Defines the value of the control.

The new value must be in the format set by valueFormat.

The "Now" literal can also be assigned as a parameter to show the current date and/or time.

When called with a value of null or undefined, the default value of the property will be restored.

Param Type DefaultValue Description
sValue string

New value for property value

setValueFormat

Sets a new value for property valueFormat.

Given value property should match with valueFormat to parse date. Default value is taken from locale settings. You can only set and get value in this format. If you use data-binding on value property with type sap.ui.model.type.Date you can ignore this property or the latter wins.

When called with a value of null or undefined, the default value of the property will be restored.

Param Type DefaultValue Description
sValueFormat string

New value for property valueFormat

setValueState

Sets a new value for property valueState.

Visualizes the validation state of the control, e.g. Error, Warning, Success.

When called with a value of null or undefined, the default value of the property will be restored.

Default value is None.

Param Type DefaultValue Description
sValueState sap.ui.core.ValueState None

New value for property valueState

setValueStateText

Sets a new value for property valueStateText.

Defines the text that appears in the value state message pop-up. If this is not specified, a default text is shown from the resource bundle.

When called with a value of null or undefined, the default value of the property will be restored.

Param Type DefaultValue Description
sValueStateText string

New value for property valueStateText

setWidth

Sets a new value for property width.

Defines the width of the control.

When called with a value of null or undefined, the default value of the property will be restored.

Default value is "100%".

Param Type DefaultValue Description
sWidth sap.ui.core.CSSSize "100%"

New value for property width

unbindValue

Unbinds property value from model data.