abstract class sap.m.DateTimeField

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

The sap.m.DateTimeField control provides a basic functionality for date/time input controls.

To be extended by date and time picker controls. For internal use only.


Constructor

Constructor for a new sap.m.DateTimeField.

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.DateTimeField(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

Holds a reference to a JavaScript Date Object. The value (string) property will be set according to it. Alternatively, if the value and valueFormat pair properties are supplied instead, the dateValue will be instantiated according to the parsed value. Use dateValue as a helper property to easily obtain the day, month, year, hours, minutes and seconds of the chosen date and time. Although possible to bind it, the recommendation is not to do it. When binding is needed, use value property instead.

Visibility: public
displayFormat string

Determines the format, displayed in the input field.

Visibility: public
initialFocusedDateValue object

Holds a reference to a JavaScript Date Object to define the initially focused date/time when the picker popup is opened.

Notes:

  • Setting this property does not change the value property.
  • Depending on the context this property is used in (sap.m.TimePicker, sap.m.DatePicker or sap.m.DateTimePicker), it takes into account only the time part, only the date part or both parts of the JavaScript Date Object.


Since: 1.54.

Visibility: public
valueFormat string

Determines the format of the value property.

Visibility: public

Borrowed Properties

Name Type Default Value Description
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

The name to be used in the HTML code (for example, for HTML forms that send data to the server via 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
required boolean false

Indicates that user input is required. This property is only needed for accessibility purposes when a single relationship between the field and a label (see aggregation labelFor of sap.m.Label) cannot be established (e.g. one label should label multiple fields).

Since: 1.38.4.

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
value string

Defines the value of the control.

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

Defines the width of the control.

Note: If the provided width is too small, the control gets stretched to its min width, which is needed in order for the control to be usable and well aligned.

Visibility: public

Borrowed Aggregations

Name Cardinality Type Description
formattedValueStateText 0..1 sap.m.FormattedText

Defines the formatted text that appears in the value state message pop-up. It can include links. If both valueStateText and formattedValueStateText are set - the latter is shown.

Since: 1.78.


Methods Overview

Method Description
sap.m.DateTimeField.extend

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

oClassInfo might contain the same kind of information as described in sap.m.InputBase.extend.

getDateValue

Gets current value of property dateValue.

Holds a reference to a JavaScript Date Object. The value (string) property will be set according to it. Alternatively, if the value and valueFormat pair properties are supplied instead, the dateValue will be instantiated according to the parsed value. Use dateValue as a helper property to easily obtain the day, month, year, hours, minutes and seconds of the chosen date and time. Although possible to bind it, the recommendation is not to do it. When binding is needed, use value property instead.

getDisplayFormat

Gets current value of property displayFormat.

Determines the format, displayed in the input field.

getInitialFocusedDateValue

Gets current value of property initialFocusedDateValue.

Holds a reference to a JavaScript Date Object to define the initially focused date/time when the picker popup is opened.

Notes:

  • Setting this property does not change the value property.
  • Depending on the context this property is used in (sap.m.TimePicker, sap.m.DatePicker or sap.m.DateTimePicker), it takes into account only the time part, only the date part or both parts of the JavaScript Date Object.

sap.m.DateTimeField.getMetadata

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

getValueFormat

Gets current value of property valueFormat.

Determines the format of the value property.

setDateValue

Sets a new value for property dateValue.

Holds a reference to a JavaScript Date Object. The value (string) property will be set according to it. Alternatively, if the value and valueFormat pair properties are supplied instead, the dateValue will be instantiated according to the parsed value. Use dateValue as a helper property to easily obtain the day, month, year, hours, minutes and seconds of the chosen date and time. Although possible to bind it, the recommendation is not to do it. When binding is needed, use value property instead.

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.

Determines the format, displayed in the input field.

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

setInitialFocusedDateValue

Sets a new value for property initialFocusedDateValue.

Holds a reference to a JavaScript Date Object to define the initially focused date/time when the picker popup is opened.

Notes:

  • Setting this property does not change the value property.
  • Depending on the context this property is used in (sap.m.TimePicker, sap.m.DatePicker or sap.m.DateTimePicker), it takes into account only the time part, only the date part or both parts of the JavaScript Date Object.

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.

Determines the format of the value property.

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

sap.m.DateTimeField.extend

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

oClassInfo might contain the same kind of information as described in sap.m.InputBase.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

getDateValue

Gets current value of property dateValue.

Holds a reference to a JavaScript Date Object. The value (string) property will be set according to it. Alternatively, if the value and valueFormat pair properties are supplied instead, the dateValue will be instantiated according to the parsed value. Use dateValue as a helper property to easily obtain the day, month, year, hours, minutes and seconds of the chosen date and time. Although possible to bind it, the recommendation is not to do it. When binding is needed, use value property instead.

getDisplayFormat

Gets current value of property displayFormat.

Determines the format, displayed in the input field.

getInitialFocusedDateValue

Gets current value of property initialFocusedDateValue.

Holds a reference to a JavaScript Date Object to define the initially focused date/time when the picker popup is opened.

Notes:

sap.m.DateTimeField.getMetadata

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

getValueFormat

Gets current value of property valueFormat.

Determines the format of the value property.

setDateValue

Sets a new value for property dateValue.

Holds a reference to a JavaScript Date Object. The value (string) property will be set according to it. Alternatively, if the value and valueFormat pair properties are supplied instead, the dateValue will be instantiated according to the parsed value. Use dateValue as a helper property to easily obtain the day, month, year, hours, minutes and seconds of the chosen date and time. Although possible to bind it, the recommendation is not to do it. When binding is needed, use value property instead.

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.

Determines the format, displayed in the input field.

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

setInitialFocusedDateValue

Sets a new value for property initialFocusedDateValue.

Holds a reference to a JavaScript Date Object to define the initially focused date/time when the picker popup is opened.

Notes:

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

Param Type DefaultValue Description
oInitialFocusedDateValue object

New value for property initialFocusedDateValue

setValueFormat

Sets a new value for property valueFormat.

Determines the format of the value property.

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