abstract class sap.ui.model.odata.type.DateTimeBase

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

This is an abstract base class for the OData primitive types Edm.DateTime and Edm.DateTimeOffset.


Constructor

Base constructor for the primitive types Edm.DateTime and Edm.DateTimeOffset.

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

Type-specific format options; see subtypes

oConstraints? object

Constraints; validateValue throws an error if any constraint is violated

isDateOnly? boolean false

If true, only the date part is used, the time part is always 00:00:00 and the time zone is UTC to avoid time-zone-related problems

nullable? boolean string true

If true, the value null is accepted

precision? boolean 0

The number of decimal places allowed in the seconds portion of a valid string value (OData V4 only); only integer values between 0 and 12 are valid (since 1.37.0)


Methods Overview

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

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

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

parseValue

Parses the given value to a Date instance (OData V2).

validateValue

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

sap.ui.model.odata.type.DateTimeBase.extend

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

The value to be formatted, which is represented in the model as a Date instance (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.DateTimeBase.getMetadata

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

parseValue

Parses the given value to a Date instance (OData V2).

Param Type DefaultValue Description
vValue string Date

The value to be parsed; the empty string and null are parsed to null

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 defined constraints.

Param Type DefaultValue Description
oValue Date

The value to be validated