class sap.ui.model.odata.type.Date

Visiblity: public
UX Guidelines:
Implements:
Available since: N/A
Module: sap/ui/model/odata/type/Date
Application Component: CA-UI5-COR

This class represents the OData V4 primitive type Edm.Date.

In sap.ui.model.odata.v4.ODataModel this type is represented as a string in the format "yyyy-MM-dd".

Note: For an OData V2 service use sap.ui.model.odata.type.DateTime with the constraint displayFormat: "Date" to display only a date.

Documentation links:


Constructor

Constructor for an OData primitive type Edm.Date.

new sap.ui.model.odata.type.Date(oFormatOptions?, oConstraints?)
Param Type Default Value Description
oFormatOptions? object

format options as defined in sap.ui.core.format.DateFormat

oConstraints? object

constraints; validateValue throws an error if any constraint is violated

nullable? boolean string true

if true, the value null is accepted


Methods Overview

Method Description
sap.ui.model.odata.type.Date.extend

Creates a new subclass of class sap.ui.model.odata.type.Date 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.model.odata.type.ODataType.extend.

formatValue

Formats the given value to the given target type.

sap.ui.model.odata.type.Date.getMetadata

Returns a metadata object for class sap.ui.model.odata.type.Date.

getName

Returns the type's name.

parseValue

Parses the given value to a date.

validateValue

Validates whether the given value in model representation is valid and meets the given constraints.

sap.ui.model.odata.type.Date.extend

Creates a new subclass of class sap.ui.model.odata.type.Date 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.model.odata.type.ODataType.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

formatValue

Formats the given value to the given target type.

Param Type DefaultValue Description
vValue string Date

the value to be formatted; string values are expected in the format "yyyy-MM-dd" used by OData V4; Date objects are expected to represent UTC as used by OData V2

sTargetType string

the target type; may be "any", "object" (since 1.69.0), "string", or a type with one of these types as its primitive type; see sap.ui.model.odata.type for more information.

sap.ui.model.odata.type.Date.getMetadata

Returns a metadata object for class sap.ui.model.odata.type.Date.

getName

Returns the type's name.

parseValue

Parses the given value to a date.

Param Type DefaultValue Description
vValue string Date

the value to be parsed, maps "" to null; Date objects are expected to represent local time and are supported if and only if source type is "object"

sSourceType string

the source type (the expected type of vValue); must be "object" (since 1.69.0), "string", or a type with one of these types as its primitive type; see sap.ui.model.odata.type for more information.

validateValue

Validates whether the given value in model representation is valid and meets the given constraints.

Param Type DefaultValue Description
sValue string

the value to be validated