class sap.ui.model.odata.type.DateTimeOffset

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

This class represents the OData primitive type Edm.DateTimeOffset.

In sap.ui.model.odata.v2.ODataModel this type is represented as a Date instance in local time. In sap.ui.model.odata.v4.ODataModel this type is represented as a string like "1970-12-31T23:59:58Z". See parameter oConstraints.V4 for more information.


Constructor

Constructor for a primitive type Edm.DateTimeOffset.

new sap.ui.model.odata.type.DateTimeOffset(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

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)

V4? boolean false

Whether OData V4 semantics apply and the model representation is expected to be a string like "1970-12-31T23:59:58Z" (see #parseValue and #validateValue); this type automatically adapts itself whenever it is used within an OData V4 model via sap.ui.model.odata.v4.ODataPropertyBinding#setType.


Methods Overview

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

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

formatValue

Formats the given value to the given target type.

sap.ui.model.odata.type.DateTimeOffset.getMetadata

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

getName

Returns the type's name.

parseValue

Parses the given value to a Date instance (OData V2) or a string like "1970-12-31T23:59:58Z" (OData V4), depending on the model's OData version.

validateValue

Validates whether the given value in model representation is valid and meets the defined constraints, depending on the model's OData version.

sap.ui.model.odata.type.DateTimeOffset.extend

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

The value to be formatted, which is represented in the model as a Date instance (OData V2) or as a string like "1970-12-31T23:59:58Z" (OData V4); both representations are accepted independent of the model's OData version

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.DateTimeOffset.getMetadata

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

getName

Returns the type's name.

parseValue

Parses the given value to a Date instance (OData V2) or a string like "1970-12-31T23:59:58Z" (OData V4), depending on the model's OData version.

Param Type DefaultValue Description
vValue Date string

The value to be parsed; the empty string and null are parsed 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 "string", "object" (since 1.69.0), 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, depending on the model's OData version.

Param Type DefaultValue Description
vValue any

The value to be validated