Abstract Class sap.ui.model.odata.type.DateTimeBaseModule: sap/ui/model/odata/type/DateTimeBase

extends ODataType
known direct subclasses: DateTime, DateTimeOffset

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


Since: 1.27.0.
Constructor Summary
new sap.ui.model.odata.type.DateTimeBase(oFormatOptions?, oConstraints?)Base constructor for the primitive types Edm.DateTime and Edm.DateTimeOffset.
Method Summary
sap.ui.model.odata.type.DateTimeBase.extend(sClassName, oClassInfo?, FNMetaImpl?)Creates a new subclass of class sap.ui.model.odata.type.DateTimeBase with name sClassName and enriches it with the information contained in oClassInfo.
sap.ui.model.odata.type.DateTimeBase.getMetadata()Returns a metadata object for class sap.ui.model.odata.type.DateTimeBase.
formatValue(oValue, sTargetType)Formats the given value to the given target type.
parseValue(sValue, sSourceType)Parses the given value to a Date instance (OData V2).
validateValue(oValue)Validates whether the given value in model representation is valid and meets the defined constraints.
Methods borrowed from class sap.ui.model.Type
Methods borrowed from class sap.ui.base.Object
Constructor Detail
new sap.ui.model.odata.type.DateTimeBase(oFormatOptions?, oConstraints?)
Base constructor for the primitive types Edm.DateTime and Edm.DateTimeOffset.
Parameters:
{object}oFormatOptions? Type-specific format options; see subtypes
{object}oConstraints? Constraints; validateValue throws an error if any constraint is violated
{boolean}oConstraints.isDateOnly? 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
{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)
Method Detail
sap.ui.model.odata.type.DateTimeBase.extend(sClassName, oClassInfo?, FNMetaImpl?): function
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.

Parameters:
{string}sClassName Name of the class being created
{object}oClassInfo? Object literal with information about the class
{function}FNMetaImpl? Constructor function for the metadata object; if not given, it defaults to sap.ui.core.ElementMetadata
Returns:
{function} Created class / constructor function
sap.ui.model.odata.type.DateTimeBase.getMetadata(): sap.ui.base.Metadata
Returns a metadata object for class sap.ui.model.odata.type.DateTimeBase.
Returns:
{sap.ui.base.Metadata} Metadata object describing this class
formatValue(oValue, sTargetType): Date|string
Formats the given value to the given target type.
Parameters:
{Date}oValue The value to be formatted, which is represented in the model as a Date instance (OData V2)
{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
parseValue(sValue, sSourceType): Date
Parses the given value to a Date instance (OData V2).
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} The parsed value
validateValue(oValue): void
Validates whether the given value in model representation is valid and meets the defined constraints.
Parameters:
{Date}oValue The value to be validated
Since:
1.27.0
Exceptions:
{sap.ui.model.ValidateException} If the value is not valid