class sap.ui.commons.DatePicker

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

Allows end users to interact with dates. Entries can directly be written in, or selected from a calendar pad. Note: Dates can always be manually entered in the fix YYYYMMDD format, on top of the flexible "locale" format. If the value is provided via data binding, using a Date.type the formatter of the Date.type is used. Since version 1.22 the unified.Calendar is used inside the datePicker. So applications using the DatePicker should load the unified library. Otherwise it will be loaded the first time a DatePicker is opened.


Constructor

Constructor for a new DatePicker.

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.ui.commons.DatePicker(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
locale string

Defines the locale (language and country), e.g. "en-US", whose translations and Date formatters should be used to render the DatePicker.If the value property is bound to a model using a Date type the locale will be ignored, because the locale information of the model are used.

Visibility: public
yyyymmdd string

Defines the date as a "yyyymmdd" string, independent from the format used. The inherited textField "value" attribute uses the date format as configured via the locale. The date is interpreted as gregorian date

Visibility: public

Borrowed Properties

Name Type Default Value Description
accessibleRole sap.ui.core.AccessibleRole Textbox

Accessibility role for the text field.

Visibility: public
design sap.ui.core.Design Standard

Font type. valid values are Standard and Monospace.

Visibility: public
editable boolean true

Switches edit state of the control. Read-only fields have different colors, depending on theme setting.

Visibility: public
enabled boolean true

Switches enabled state of the control. Disabled fields have different colors, and can not be focused.

Visibility: public
helpId string empty string

Unique identifier used for help service.

Visibility: public
imeMode sap.ui.core.ImeMode Auto

State of the Input Method Editor (IME).

Visibility: public
maxLength int 0

Maximum number of characters. Value '0' means the feature is switched off.

Visibility: public
name string

The name property to be used in the HTML code (e.g. for HTML forms that send data to the server via 'submit').

Visibility: public
placeholder string

Placeholder for the text field.

Since: 1.14.0.

Visibility: public
required boolean false

Depending on theme the TextField is shown as required. If a Label is assigned to the TextField it will visualize the requires state too.

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

Sets the horizontal alignment of the text.

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

Direction of the text. Possible values: "rtl", "ltr".

Visibility: public
value string empty string

Text inside the TextField

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

Visualizes warnings or errors related to the text field. Possible values: Warning, Error, Success.

Visibility: public
width sap.ui.core.CSSSize

Width of text field. When it is set (CSS-size such as % or px), this is the exact size. When left blank, the text field length defines the width.

Visibility: public

Methods Overview

Method Description
sap.ui.commons.DatePicker.extend

Creates a new subclass of class sap.ui.commons.DatePicker 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.commons.TextField.extend.

fireChange

Fire event change to attached listeners.

Provides the following event parameters:

  • 'newValue' of type string The new / changed value of the DatePicker.
  • 'newYyyymmdd' of type string The new / changed Yyyymmdd of the DatePicker.
  • 'invalidValue' of type boolean The new / changed value of the DatePicker is not a valid date.

getAccessibilityInfo

References:

  • sap.ui.core.Control#getAccessibilityInfo

getLocale

Gets current value of property locale.

Defines the locale (language and country), e.g. "en-US", whose translations and Date formatters should be used to render the DatePicker.If the value property is bound to a model using a Date type the locale will be ignored, because the locale information of the model are used.

sap.ui.commons.DatePicker.getMetadata

Returns a metadata object for class sap.ui.commons.DatePicker.

getYyyymmdd

Gets current value of property yyyymmdd.

Defines the date as a "yyyymmdd" string, independent from the format used. The inherited textField "value" attribute uses the date format as configured via the locale. The date is interpreted as gregorian date

setLocale

Sets a new value for property locale.

Defines the locale (language and country), e.g. "en-US", whose translations and Date formatters should be used to render the DatePicker.If the value property is bound to a model using a Date type the locale will be ignored, because the locale information of the model are used.

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

setYyyymmdd

Sets a new value for property yyyymmdd.

Defines the date as a "yyyymmdd" string, independent from the format used. The inherited textField "value" attribute uses the date format as configured via the locale. The date is interpreted as gregorian date

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

sap.ui.commons.DatePicker.extend

Creates a new subclass of class sap.ui.commons.DatePicker 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.commons.TextField.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

Fire event change to attached listeners.

Provides the following event parameters:

Param Type DefaultValue Description
mParameters object

Parameters to pass along with the event - do not use: value is ignored

bInvalidValue boolean

true if value is invalid

getAccessibilityInfo

References:

getLocale

Gets current value of property locale.

Defines the locale (language and country), e.g. "en-US", whose translations and Date formatters should be used to render the DatePicker.If the value property is bound to a model using a Date type the locale will be ignored, because the locale information of the model are used.

sap.ui.commons.DatePicker.getMetadata

Returns a metadata object for class sap.ui.commons.DatePicker.

getYyyymmdd

Gets current value of property yyyymmdd.

Defines the date as a "yyyymmdd" string, independent from the format used. The inherited textField "value" attribute uses the date format as configured via the locale. The date is interpreted as gregorian date

setLocale

Sets a new value for property locale.

Defines the locale (language and country), e.g. "en-US", whose translations and Date formatters should be used to render the DatePicker.If the value property is bound to a model using a Date type the locale will be ignored, because the locale information of the model are used.

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

Param Type DefaultValue Description
sLocale string

New value for property locale

setYyyymmdd

Sets a new value for property yyyymmdd.

Defines the date as a "yyyymmdd" string, independent from the format used. The inherited textField "value" attribute uses the date format as configured via the locale. The date is interpreted as gregorian date

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

Param Type DefaultValue Description
sYyyymmdd string

New value for property yyyymmdd