class sap.ui.core.date.UniversalDate

Visiblity: restricted
UX Guidelines:
Implements:
Available since: N/A
Module: sap/ui/core/date/UniversalDate
Application Component: CA-UI5-COR

The UniversalDate is the base class of calendar date instances. It contains the static methods to create calendar specific instances.

The member variable this.oDate contains the JS Date object, which is the source value of the date information. The prototype is containing getters and setters of the JS Date and is delegating them to the internal date object. Implementations for specific calendars may override methods needed for their specific calendar (e.g. getYear and getEra for Japanese emperor calendar);


Constructor

Constructor for UniversalDate.

new sap.ui.core.date.UniversalDate()

Methods Overview

Method Description
sap.ui.core.date.UniversalDate.extend

Creates a new subclass of class sap.ui.core.date.UniversalDate 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.base.Object.extend.

sap.ui.core.date.UniversalDate.getClass

Returns a specific Date class, based on the calendar type from the configuration, or as explicitly defined by parameter. The object provides all methods also known on the JavaScript Date object.

sap.ui.core.date.UniversalDate.getInstance

Returns an instance of Date, based on the calendar type from the configuration, or as explicitly defined by parameter. The object provides all methods also known on the JavaScript Date object.

Note: Prefer this method over calling new UniversalDate with an instance of Date

getJSDate

Returns the JS date object representing the current calendar date value.

sap.ui.core.date.UniversalDate.getMetadata

Returns a metadata object for class sap.ui.core.date.UniversalDate.

sap.ui.core.date.UniversalDate.extend

Creates a new subclass of class sap.ui.core.date.UniversalDate 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.base.Object.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

sap.ui.core.date.UniversalDate.getClass

Returns a specific Date class, based on the calendar type from the configuration, or as explicitly defined by parameter. The object provides all methods also known on the JavaScript Date object.

Param Type DefaultValue Description
sCalendarType sap.ui.core.CalendarType

the type of the used calendar

sap.ui.core.date.UniversalDate.getInstance

Returns an instance of Date, based on the calendar type from the configuration, or as explicitly defined by parameter. The object provides all methods also known on the JavaScript Date object.

Note: Prefer this method over calling new UniversalDate with an instance of Date

Param Type DefaultValue Description
oDate Date sap.ui.core.date.UniversalDate

JavaScript date object, defaults to new Date()

sCalendarType sap.ui.core.CalendarType

The calendar type, defaults to sap.ui.getCore().getConfiguration().getCalendarType()

getJSDate

Returns the JS date object representing the current calendar date value.

sap.ui.core.date.UniversalDate.getMetadata

Returns a metadata object for class sap.ui.core.date.UniversalDate.