Class sap.ui.model.odata.type.DateTimeOffsetModule: sap/ui/model/odata/type/DateTimeOffset

extends DateTimeBase

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 "2014-11-27T13:47:26Z". See parameter oConstraints.V4 for more information.


Since: 1.27.0.
Constructor Summary
new sap.ui.model.odata.type.DateTimeOffset(oFormatOptions?, oConstraints?)Constructor for a primitive type Edm.DateTimeOffset.
Method Summary
formatValue(vValue, sTargetType)Formats the given value to the given target type.
getName()Returns the type's name.
parseValue(sValue, sSourceType)Parses the given value to a Date instance (OData V2) or a string like "2014-11-27T13:47:26Z" (OData V4), depending on the model's OData version.
validateValue(vValue)Validates whether the given value in model representation is valid and meets the defined constraints, depending on the model's OData version.
Methods borrowed from class sap.ui.base.Object
Constructor Detail
new sap.ui.model.odata.type.DateTimeOffset(oFormatOptions?, oConstraints?)
Constructor for a primitive type Edm.DateTimeOffset.
Parameters:
{object}oFormatOptions? Format options as defined in sap.ui.core.format.DateFormat
{object}oConstraints? Constraints; validateValue throws an error if any constraint is violated
{boolean|string}oConstraints.nullable?, Default: true If true, the value null is accepted
{boolean}oConstraints.precision? 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)
{boolean}oConstraints.V4? Whether OData V4 semantics apply and the model representation is expected to be a string like "2014-11-27T13:47:26Z" (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.
Method Detail
formatValue(vValue, sTargetType): Date|string
Formats the given value to the given target type.
Parameters:
{Date|string}vValue The value to be formatted, which is represented in the model as a Date instance (OData V2) or as a string like "2014-11-27T13:47:26Z" (OData V4); both representations are accepted independent of the model's OData version
{string}sTargetType The target type, may be "any" or "string"; see sap.ui.model.odata.type for more information
Since:
1.27.0
Exceptions:
{sap.ui.model.FormatException} If sTargetType is not supported
Returns:
{Date|string} The formatted output value in the target type; undefined or null are formatted to null
getName(): string
Returns the type's name.
Returns:
{string} The type's name
parseValue(sValue, sSourceType): Date|string
Parses the given value to a Date instance (OData V2) or a string like "2014-11-27T13:47:26Z" (OData V4), depending on the model's OData version.
Parameters:
{string}sValue The value to be parsed; the empty string and null are parsed to null
{string}sSourceType The source type (the expected type of sValue), must be "string"; see sap.ui.model.odata.type for more information
Since:
1.27.0
Exceptions:
{sap.ui.model.ParseException} If sSourceType is not supported or if the given string cannot be parsed to a Date
Returns:
{Date|string} The parsed value
validateValue(vValue): void
Validates whether the given value in model representation is valid and meets the defined constraints, depending on the model's OData version.
Parameters:
{any}vValue The value to be validated
Since:
1.27.0
Exceptions:
{sap.ui.model.ValidateException} If the value is not valid