Class sap.m.DateTimePickerModule: sap/m/DateTimePicker
This is a date input control with a calendar and a time selector as date time picker.
A date can be entered using a calendar or time selector that opens in a popup. Alternatively a value can be entered directly in the input field by typing it in. If a date is entered by typing it into the input field, it must fit the used date format and locale. (See sap.ui.core.format.DateFormat
)
There are two options to provide a date for the DateTimePicker
. You can put a date as a string to the property value
or you can put a JavaScript Date object to the property dateValue
. Only one of the properties should be used at one time, but they are synchronized internally. What property you should use depends on the use case of the application:
- Use the
value
property if you want to bind theDateTimePicker
to a model using thesap.ui.model.type.DateTime
. - Use the
value
property if the date is provided as a string from the back end or inside the application (e.g. as ABAP type DATS field). - Use the
dateValue
property if the date is already provided as a JavaScript Date object or you want to work with a JavaScript Date object.
All formatting and parsing of dates to and from strings is done using the sap.ui.core.format.DateFormat, so please read the corresponding documentation if you need more information about this.
Supported format options are pattern-based on Unicode LDML Date Format notation. http://unicode.org/reports/tr35/#Date_Field_Symbol_Table
For example, if the valueFormat
is "yyyy-MM-dd-HH-mm-ss", displayFormat
is "MMM d, y, HH:mm:ss" and the used locale is English, a valid value
string is "2015-07-30-10-30-15", which leads to an output of "Jul 30, 2015, 10:30:15".
If no placeholder
is set to the DateTimePicker
, the used displayFormat
is shown as a placeholder. If another placeholder is needed, it must be set.
Internally the sap.ui.unified.Calendar
is used, but it is only needed if the DateTimePicker
is opened. This means that it is not needed for the initial rendering. If the sap.ui.unified
library is not loaded before the DateTimePicker
is opened, it will be loaded upon opening. This could lead to a waiting time before a DateTimePicker
is opened the first time. To prevent this, applications using the DateTimePicker
should also load the sap.ui.unified
library.
Since: 1.38.0.
sClassName
and enriches it with the information contained in oClassInfo
. Accepts an object literal mSettings
that defines initial property values, aggregated and associated objects as well as event handlers. See sap.ui.base.ManagedObject for a general description of the syntax of the settings object.
The supported settings are:
- Aggregations
In addition, all settings applicable to the base type sap.m.DatePicker can be used as well.
{string} | sId? | ID for the new control, generated automatically if no ID is given |
{object} | mSettings? | Initial settings for the new control |
sClassName
and enriches it with the information contained in oClassInfo
. oClassInfo
might contain the same kind of information as described in sap.m.DatePicker.extend.
{string} | sClassName | Name of the class being created |
{object} | oClassInfo? | Object literal with information about the class |
{function} | FNMetaImpl? | Constructor function for the metadata object; if not given, it defaults to sap.ui.core.ElementMetadata |
{function} | Created class / constructor function |
{sap.ui.base.Metadata} | Metadata object describing this class |