class sap.ui.unified.Calendar

Control sample: sap.ui.unified.Calendar
Visiblity: public
UX Guidelines:
Implements:
Available since: N/A
Module: sap/ui/unified/Calendar
Application Component: CA-UI5-CTR

Basic Calendar. This calendar is used for DatePickers


Constructor

Constructor for a new Calendar.

Accepts an object literal mSettings that defines initial property values, aggregated and associated objects as well as event handlers. See sap.ui.base.ManagedObject#constructor for a general description of the syntax of the settings object.

new sap.ui.unified.Calendar(sId?, mSettings?)
Param Type Default Value Description
sId? string

id for the new control, generated automatically if no id is given

mSettings? Object

initial settings for the new control


Properties

Name Type Default Value Description
_currentPicker string

Holds a reference to the currently shown picker. Possible values: month, monthPicker, yearPicker and yearRangePicker.

Since: 1.84.0.

Visibility: hidden
firstDayOfWeek int -1

If set, the first day of the displayed week is this day. Valid values are 0 to 6. If not a valid value is set, the default of the used locale is used.

Since: 1.28.9.

Visibility: public
intervalSelection boolean false

If set, interval selection is allowed

Visibility: public
maxDate object

Maximum date that can be shown and selected in the Calendar. This must be a JavaScript date object.

Note: if the date is inside of a month the complete month is displayed, but dates outside the valid range can not be selected.

Note: If the maxDate is set to be before the minDate, the minDate is set to the begin of the month of the maxDate.

Since: 1.38.0.

Visibility: public
minDate object

Minimum date that can be shown and selected in the Calendar. This must be a JavaScript date object.

Note: if the date is inside of a month the complete month is displayed, but dates outside the valid range can not be selected.

Note: If the minDate is set to be after the maxDate, the maxDate is set to the end of the month of the minDate.

Since: 1.38.0.

Visibility: public
months int 1

Determines the number of months displayed.

As of version 1.50, the duplicated dates are not displayed if there are multiple months.

Note: On phones, only one month is displayed.

Since: 1.28.0.

Visibility: public
nonWorkingDays int[]

If set, the provided weekdays are displayed as non-working days. Valid values inside the array are 0 to 6. If not set, the weekend defined in the locale settings is displayed as non-working days.

Note: Keep in mind that this property sets only weekly-recurring days as non-working. If you need specific dates or dates ranges, such as national holidays, use the specialDates aggregation to set them. Both the non-working days (from property) and dates (from aggregation) are visualized the same.

Since: 1.28.9.

Visibility: public
primaryCalendarType sap.ui.core.CalendarType

If set, the calendar type is used for display. If not set, the calendar type of the global configuration is used.

Since: 1.34.0.

Visibility: public
secondaryCalendarType sap.ui.core.CalendarType

If set, the days are also displayed in this calendar type If not set, the dates are only displayed in the primary calendar type

Since: 1.34.0.

Visibility: public
showCurrentDateButton boolean false

Determines whether there is a shortcut navigation to Today. When used in Month, Year or Year-range picker view, the calendar navigates to Day picker view.

Since: 1.95.

Visibility: public
showWeekNumbers boolean true

Determines whether the week numbers in the months are displayed.

Note: For Islamic calendars, the week numbers are not displayed regardless of what is set to this property.

Since: 1.48.

Visibility: public
singleSelection boolean true

If set, only a single date or interval, if intervalSelection is enabled, can be selected

Visibility: public
width sap.ui.core.CSSSize

Width of Calendar

Note: There is a theme depending minimum width, so the calendar can not be set smaller.

Since: 1.38.0.

Visibility: public

Aggregations

Default Aggregation:

Name Cardinality Type Description
disabledDates 0..n sap.ui.unified.DateRange

Dates or date ranges for disabled dates.

To set a single date (instead of a range), set only the startDate property of the sap.ui.unified.DateRange class.

Since: 1.38.0.

header 0..1 sap.ui.core.Control

Hidden, for internal use only.

month 0..n sap.ui.unified.calendar.Month
monthPicker 0..1 sap.ui.unified.calendar.MonthPicker
secondMonthHeader 0..1 sap.ui.unified.calendar.Header
selectedDates 0..n sap.ui.unified.DateRange

Dates or date ranges for selected dates.

To set a single date (instead of a range), set only the startDate property of the sap.ui.unified.DateRange class.

specialDates 0..n sap.ui.unified.DateTypeRange

Dates or date ranges with type, to visualize special days in the Calendar. If one day is assigned to more than one Type, only the first one will be used.

To set a single date (instead of a range), set only the startDate property of the sap.ui.unified.DateRange class.

Note: Keep in mind that the NonWorking type is for marking specific dates or date ranges as non-working, where if you need a weekly-reccuring non-working days (weekend), you should use the nonWorkingDays property. Both the non-working days (from property) and dates (from aggregation) are visualized the same.

Since: 1.24.0.

yearPicker 0..1 sap.ui.unified.calendar.YearPicker
yearRangePicker 0..1 sap.ui.unified.calendar.YearPicker

Associations

Name Cardinality Type Description
ariaLabelledBy 0..n sap.ui.core.Control

Association to controls / ids which label this control (see WAI-ARIA attribute aria-labelledby).

Since: 1.28.0.

legend 0..1 sap.ui.unified.CalendarLegend

Association to the CalendarLegend explaining the colors of the specialDates.

Note The legend does not have to be rendered but must exist, and all required types must be assigned.

Since: 1.38.5.


Events Overview

Event Description
cancel

Date selection was cancelled

select

Date selection changed

startDateChange

startDate was changed while navigation in Calendar

Use getStartDate function to determine the current start date

Since: 1.34.0.

weekNumberSelect

Week number selection changed. By default, clicking on the week number will select the corresponding week. If the week has already been selected, clicking the week number will deselect it.

The default behavior can be prevented using the preventDefault method.

Note Works for Gregorian calendars only and when intervalSelection is set to 'true'.

Listeners may prevent the default action of this event by calling the preventDefault method on the event object.

Since: 1.56.

cancel

Date selection was cancelled

Param Type Description
oControlEvent sap.ui.base.Event
getSource sap.ui.base.EventProvider
getParameters object

select

Date selection changed

Param Type Description
oControlEvent sap.ui.base.Event
getSource sap.ui.base.EventProvider
getParameters object

startDateChange

startDate was changed while navigation in Calendar

Use getStartDate function to determine the current start date

Since: 1.34.0.

Param Type Description
oControlEvent sap.ui.base.Event
getSource sap.ui.base.EventProvider
getParameters object

weekNumberSelect

Week number selection changed. By default, clicking on the week number will select the corresponding week. If the week has already been selected, clicking the week number will deselect it.

The default behavior can be prevented using the preventDefault method.

Note Works for Gregorian calendars only and when intervalSelection is set to 'true'.

Listeners may prevent the default action of this event by calling the preventDefault method on the event object.

Since: 1.56.

Param Type Description
oControlEvent sap.ui.base.Event
getSource sap.ui.base.EventProvider
getParameters object
weekNumber int

The selected week number.

weekDays sap.ui.unified.DateRange

The days of the corresponding week that are selected or deselected.


Methods Overview

Method Description
addAriaLabelledBy

Adds some ariaLabelledBy into the association ariaLabelledBy.

addDisabledDate

Adds some disabledDate to the aggregation disabledDates.

addSelectedDate

Adds some selectedDate to the aggregation selectedDates.

addSpecialDate

Adds some specialDate to the aggregation specialDates.

attachCancel

Attaches event handler fnFunction to the cancel event of this sap.ui.unified.Calendar.

When called, the context of the event handler (its this) will be bound to oListener if specified, otherwise it will be bound to this sap.ui.unified.Calendar itself.

Date selection was cancelled

attachSelect

Attaches event handler fnFunction to the select event of this sap.ui.unified.Calendar.

When called, the context of the event handler (its this) will be bound to oListener if specified, otherwise it will be bound to this sap.ui.unified.Calendar itself.

Date selection changed

attachStartDateChange

Attaches event handler fnFunction to the startDateChange event of this sap.ui.unified.Calendar.

When called, the context of the event handler (its this) will be bound to oListener if specified, otherwise it will be bound to this sap.ui.unified.Calendar itself.

startDate was changed while navigation in Calendar

Use getStartDate function to determine the current start date

attachWeekNumberSelect

Attaches event handler fnFunction to the weekNumberSelect event of this sap.ui.unified.Calendar.

When called, the context of the event handler (its this) will be bound to oListener if specified, otherwise it will be bound to this sap.ui.unified.Calendar itself.

Week number selection changed. By default, clicking on the week number will select the corresponding week. If the week has already been selected, clicking the week number will deselect it.

The default behavior can be prevented using the preventDefault method.

Note Works for Gregorian calendars only and when intervalSelection is set to 'true'.

destroyDisabledDates

Destroys all the disabledDates in the aggregation disabledDates.

destroySelectedDates

Destroys all the selectedDates in the aggregation selectedDates.

destroySpecialDates

Destroys all the specialDates in the aggregation specialDates.

detachCancel

Detaches event handler fnFunction from the cancel event of this sap.ui.unified.Calendar.

The passed function and listener object must match the ones used for event registration.

detachSelect

Detaches event handler fnFunction from the select event of this sap.ui.unified.Calendar.

The passed function and listener object must match the ones used for event registration.

detachStartDateChange

Detaches event handler fnFunction from the startDateChange event of this sap.ui.unified.Calendar.

The passed function and listener object must match the ones used for event registration.

detachWeekNumberSelect

Detaches event handler fnFunction from the weekNumberSelect event of this sap.ui.unified.Calendar.

The passed function and listener object must match the ones used for event registration.

displayDate

Displays a date in the calendar but doesn't set the focus.

sap.ui.unified.Calendar.extend

Creates a new subclass of class sap.ui.unified.Calendar 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.core.Control.extend.

fireCancel

Fires event cancel to attached listeners.

fireSelect

Fires event select to attached listeners.

fireStartDateChange

Fires event startDateChange to attached listeners.

fireWeekNumberSelect

Fires event weekNumberSelect to attached listeners.

Listeners may prevent the default action of this event by calling the preventDefault method on the event object. The return value of this method indicates whether the default action should be executed.

focusDate

Displays and sets the focused date of the calendar.

getAriaLabelledBy

Returns array of IDs of the elements which are the current targets of the association ariaLabelledBy.

getDisabledDates

Gets content of aggregation disabledDates.

Dates or date ranges for disabled dates.

To set a single date (instead of a range), set only the startDate property of the sap.ui.unified.DateRange class.

getFirstDayOfWeek

Gets current value of property firstDayOfWeek.

If set, the first day of the displayed week is this day. Valid values are 0 to 6. If not a valid value is set, the default of the used locale is used.

Default value is -1.

getIntervalSelection

Gets current value of property intervalSelection.

If set, interval selection is allowed

Default value is false.

getLegend

ID of the element which is the current target of the association legend, or null.

getMaxDate

Gets current value of property maxDate.

Maximum date that can be shown and selected in the Calendar. This must be a JavaScript date object.

Note: if the date is inside of a month the complete month is displayed, but dates outside the valid range can not be selected.

Note: If the maxDate is set to be before the minDate, the minDate is set to the begin of the month of the maxDate.

sap.ui.unified.Calendar.getMetadata

Returns a metadata object for class sap.ui.unified.Calendar.

getMinDate

Gets current value of property minDate.

Minimum date that can be shown and selected in the Calendar. This must be a JavaScript date object.

Note: if the date is inside of a month the complete month is displayed, but dates outside the valid range can not be selected.

Note: If the minDate is set to be after the maxDate, the maxDate is set to the end of the month of the minDate.

getMonths

Gets current value of property months.

Determines the number of months displayed.

As of version 1.50, the duplicated dates are not displayed if there are multiple months.

Note: On phones, only one month is displayed.

Default value is 1.

getNonWorkingDays

Gets current value of property nonWorkingDays.

If set, the provided weekdays are displayed as non-working days. Valid values inside the array are 0 to 6. If not set, the weekend defined in the locale settings is displayed as non-working days.

Note: Keep in mind that this property sets only weekly-recurring days as non-working. If you need specific dates or dates ranges, such as national holidays, use the specialDates aggregation to set them. Both the non-working days (from property) and dates (from aggregation) are visualized the same.

getPrimaryCalendarType

Gets current value of property primaryCalendarType.

If set, the calendar type is used for display. If not set, the calendar type of the global configuration is used.

getSecondaryCalendarType

Gets current value of property secondaryCalendarType.

If set, the days are also displayed in this calendar type If not set, the dates are only displayed in the primary calendar type

getSelectedDates

Gets content of aggregation selectedDates.

Dates or date ranges for selected dates.

To set a single date (instead of a range), set only the startDate property of the sap.ui.unified.DateRange class.

getShowCurrentDateButton

Gets current value of property showCurrentDateButton.

Determines whether there is a shortcut navigation to Today. When used in Month, Year or Year-range picker view, the calendar navigates to Day picker view.

Default value is false.

getShowWeekNumbers

Gets current value of property showWeekNumbers.

Determines whether the week numbers in the months are displayed.

Note: For Islamic calendars, the week numbers are not displayed regardless of what is set to this property.

Default value is true.

getSingleSelection

Gets current value of property singleSelection.

If set, only a single date or interval, if intervalSelection is enabled, can be selected

Default value is true.

getSpecialDates

Gets content of aggregation specialDates.

Dates or date ranges with type, to visualize special days in the Calendar. If one day is assigned to more than one Type, only the first one will be used.

To set a single date (instead of a range), set only the startDate property of the sap.ui.unified.DateRange class.

Note: Keep in mind that the NonWorking type is for marking specific dates or date ranges as non-working, where if you need a weekly-reccuring non-working days (weekend), you should use the nonWorkingDays property. Both the non-working days (from property) and dates (from aggregation) are visualized the same.

getStartDate

Returns the first day of the displayed month.

There might be some days of the previous month shown, but they can not be focused.

getWidth

Gets current value of property width.

Width of Calendar

Note: There is a theme depending minimum width, so the calendar can not be set smaller.

indexOfDisabledDate

Checks for the provided sap.ui.unified.DateRange in the aggregation disabledDates. and returns its index if found or -1 otherwise.

indexOfSelectedDate

Checks for the provided sap.ui.unified.DateRange in the aggregation selectedDates. and returns its index if found or -1 otherwise.

indexOfSpecialDate

Checks for the provided sap.ui.unified.DateTypeRange in the aggregation specialDates. and returns its index if found or -1 otherwise.

insertDisabledDate

Inserts a disabledDate into the aggregation disabledDates.

insertSelectedDate

Inserts a selectedDate into the aggregation selectedDates.

insertSpecialDate

Inserts a specialDate into the aggregation specialDates.

removeAllAriaLabelledBy

Removes all the controls in the association named ariaLabelledBy.

removeAllDisabledDates

Removes all the controls from the aggregation disabledDates.

Additionally, it unregisters them from the hosting UIArea.

removeAllSelectedDates

Removes all the controls from the aggregation selectedDates.

Additionally, it unregisters them from the hosting UIArea.

removeAllSpecialDates

Removes all the controls from the aggregation specialDates.

Additionally, it unregisters them from the hosting UIArea.

removeAriaLabelledBy

Removes an ariaLabelledBy from the association named ariaLabelledBy.

removeDisabledDate

Removes a disabledDate from the aggregation disabledDates.

removeSelectedDate

Removes a selectedDate from the aggregation selectedDates.

removeSpecialDate

Removes a specialDate from the aggregation specialDates.

setFirstDayOfWeek

Sets a new value for property firstDayOfWeek.

If set, the first day of the displayed week is this day. Valid values are 0 to 6. If not a valid value is set, the default of the used locale is used.

When called with a value of null or undefined, the default value of the property will be restored.

Default value is -1.

setIntervalSelection

Sets a new value for property intervalSelection.

If set, interval selection is allowed

When called with a value of null or undefined, the default value of the property will be restored.

Default value is false.

setLegend

Sets the associated legend.

setMaxDate

Sets a maximum date for the calendar.

setMinDate

Sets a minimum date for the calendar.

setMonths

Sets a new value for property months.

Determines the number of months displayed.

As of version 1.50, the duplicated dates are not displayed if there are multiple months.

Note: On phones, only one month is displayed.

When called with a value of null or undefined, the default value of the property will be restored.

Default value is 1.

setNonWorkingDays

Sets a new value for property nonWorkingDays.

If set, the provided weekdays are displayed as non-working days. Valid values inside the array are 0 to 6. If not set, the weekend defined in the locale settings is displayed as non-working days.

Note: Keep in mind that this property sets only weekly-recurring days as non-working. If you need specific dates or dates ranges, such as national holidays, use the specialDates aggregation to set them. Both the non-working days (from property) and dates (from aggregation) are visualized the same.

When called with a value of null or undefined, the default value of the property will be restored.

setPrimaryCalendarType

Sets a new value for property primaryCalendarType.

If set, the calendar type is used for display. If not set, the calendar type of the global configuration is used.

When called with a value of null or undefined, the default value of the property will be restored.

setSecondaryCalendarType

Sets a new value for property secondaryCalendarType.

If set, the days are also displayed in this calendar type If not set, the dates are only displayed in the primary calendar type

When called with a value of null or undefined, the default value of the property will be restored.

setShowCurrentDateButton

Sets the visibility of the Current date button in the calendar.

setShowWeekNumbers

Sets a new value for property showWeekNumbers.

Determines whether the week numbers in the months are displayed.

Note: For Islamic calendars, the week numbers are not displayed regardless of what is set to this property.

When called with a value of null or undefined, the default value of the property will be restored.

Default value is true.

setSingleSelection

Sets a new value for property singleSelection.

If set, only a single date or interval, if intervalSelection is enabled, can be selected

When called with a value of null or undefined, the default value of the property will be restored.

Default value is true.

setWidth

Sets a new value for property width.

Width of Calendar

Note: There is a theme depending minimum width, so the calendar can not be set smaller.

When called with a value of null or undefined, the default value of the property will be restored.

addAriaLabelledBy

Adds some ariaLabelledBy into the association ariaLabelledBy.

Param Type DefaultValue Description
vAriaLabelledBy sap.ui.core.ID sap.ui.core.Control

The ariaLabelledBy to add; if empty, nothing is inserted

addDisabledDate

Adds some disabledDate to the aggregation disabledDates.

Param Type DefaultValue Description
oDisabledDate sap.ui.unified.DateRange

The disabledDate to add; if empty, nothing is inserted

addSelectedDate

Adds some selectedDate to the aggregation selectedDates.

Param Type DefaultValue Description
oSelectedDate sap.ui.unified.DateRange

The selectedDate to add; if empty, nothing is inserted

addSpecialDate

Adds some specialDate to the aggregation specialDates.

Param Type DefaultValue Description
oSpecialDate sap.ui.unified.DateTypeRange

The specialDate to add; if empty, nothing is inserted

attachCancel

Attaches event handler fnFunction to the cancel event of this sap.ui.unified.Calendar.

When called, the context of the event handler (its this) will be bound to oListener if specified, otherwise it will be bound to this sap.ui.unified.Calendar itself.

Date selection was cancelled

Param Type DefaultValue Description
oData object

An application-specific payload object that will be passed to the event handler along with the event object when firing the event

fnFunction function(sap.ui.base.Event) : void

The function to be called when the event occurs

oListener object

Context object to call the event handler with. Defaults to this sap.ui.unified.Calendar itself

attachSelect

Attaches event handler fnFunction to the select event of this sap.ui.unified.Calendar.

When called, the context of the event handler (its this) will be bound to oListener if specified, otherwise it will be bound to this sap.ui.unified.Calendar itself.

Date selection changed

Param Type DefaultValue Description
oData object

An application-specific payload object that will be passed to the event handler along with the event object when firing the event

fnFunction function(sap.ui.base.Event) : void

The function to be called when the event occurs

oListener object

Context object to call the event handler with. Defaults to this sap.ui.unified.Calendar itself

attachStartDateChange

Attaches event handler fnFunction to the startDateChange event of this sap.ui.unified.Calendar.

When called, the context of the event handler (its this) will be bound to oListener if specified, otherwise it will be bound to this sap.ui.unified.Calendar itself.

startDate was changed while navigation in Calendar

Use getStartDate function to determine the current start date

Param Type DefaultValue Description
oData object

An application-specific payload object that will be passed to the event handler along with the event object when firing the event

fnFunction function(sap.ui.base.Event) : void

The function to be called when the event occurs

oListener object

Context object to call the event handler with. Defaults to this sap.ui.unified.Calendar itself

attachWeekNumberSelect

Attaches event handler fnFunction to the weekNumberSelect event of this sap.ui.unified.Calendar.

When called, the context of the event handler (its this) will be bound to oListener if specified, otherwise it will be bound to this sap.ui.unified.Calendar itself.

Week number selection changed. By default, clicking on the week number will select the corresponding week. If the week has already been selected, clicking the week number will deselect it.

The default behavior can be prevented using the preventDefault method.

Note Works for Gregorian calendars only and when intervalSelection is set to 'true'.

Param Type DefaultValue Description
oData object

An application-specific payload object that will be passed to the event handler along with the event object when firing the event

fnFunction function(sap.ui.base.Event) : void

The function to be called when the event occurs

oListener object

Context object to call the event handler with. Defaults to this sap.ui.unified.Calendar itself

destroyDisabledDates

Destroys all the disabledDates in the aggregation disabledDates.

destroySelectedDates

Destroys all the selectedDates in the aggregation selectedDates.

destroySpecialDates

Destroys all the specialDates in the aggregation specialDates.

detachCancel

Detaches event handler fnFunction from the cancel event of this sap.ui.unified.Calendar.

The passed function and listener object must match the ones used for event registration.

Param Type DefaultValue Description
fnFunction function(sap.ui.base.Event) : void

The function to be called, when the event occurs

oListener object

Context object on which the given function had to be called

detachSelect

Detaches event handler fnFunction from the select event of this sap.ui.unified.Calendar.

The passed function and listener object must match the ones used for event registration.

Param Type DefaultValue Description
fnFunction function(sap.ui.base.Event) : void

The function to be called, when the event occurs

oListener object

Context object on which the given function had to be called

detachStartDateChange

Detaches event handler fnFunction from the startDateChange event of this sap.ui.unified.Calendar.

The passed function and listener object must match the ones used for event registration.

Param Type DefaultValue Description
fnFunction function(sap.ui.base.Event) : void

The function to be called, when the event occurs

oListener object

Context object on which the given function had to be called

detachWeekNumberSelect

Detaches event handler fnFunction from the weekNumberSelect event of this sap.ui.unified.Calendar.

The passed function and listener object must match the ones used for event registration.

Param Type DefaultValue Description
fnFunction function(sap.ui.base.Event) : void

The function to be called, when the event occurs

oListener object

Context object on which the given function had to be called

displayDate

Displays a date in the calendar but doesn't set the focus.

Param Type DefaultValue Description
oDate Object

JavaScript date object for focused date.

sap.ui.unified.Calendar.extend

Creates a new subclass of class sap.ui.unified.Calendar 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.core.Control.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

fireCancel

Fires event cancel to attached listeners.

Param Type DefaultValue Description
mParameters object

Parameters to pass along with the event

fireSelect

Fires event select to attached listeners.

Param Type DefaultValue Description
mParameters object

Parameters to pass along with the event

fireStartDateChange

Fires event startDateChange to attached listeners.

Param Type DefaultValue Description
mParameters object

Parameters to pass along with the event

fireWeekNumberSelect

Fires event weekNumberSelect to attached listeners.

Listeners may prevent the default action of this event by calling the preventDefault method on the event object. The return value of this method indicates whether the default action should be executed.

Param Type DefaultValue Description
mParameters object

Parameters to pass along with the event

weekNumber int

The selected week number.

weekDays sap.ui.unified.DateRange

The days of the corresponding week that are selected or deselected.

focusDate

Displays and sets the focused date of the calendar.

Param Type DefaultValue Description
oDate Object

A JavaScript date object for focused date

getAriaLabelledBy

Returns array of IDs of the elements which are the current targets of the association ariaLabelledBy.

getDisabledDates

Gets content of aggregation disabledDates.

Dates or date ranges for disabled dates.

To set a single date (instead of a range), set only the startDate property of the sap.ui.unified.DateRange class.

getFirstDayOfWeek

Gets current value of property firstDayOfWeek.

If set, the first day of the displayed week is this day. Valid values are 0 to 6. If not a valid value is set, the default of the used locale is used.

Default value is -1.

getIntervalSelection

Gets current value of property intervalSelection.

If set, interval selection is allowed

Default value is false.

getLegend

ID of the element which is the current target of the association legend, or null.

getMaxDate

Gets current value of property maxDate.

Maximum date that can be shown and selected in the Calendar. This must be a JavaScript date object.

Note: if the date is inside of a month the complete month is displayed, but dates outside the valid range can not be selected.

Note: If the maxDate is set to be before the minDate, the minDate is set to the begin of the month of the maxDate.

sap.ui.unified.Calendar.getMetadata

Returns a metadata object for class sap.ui.unified.Calendar.

getMinDate

Gets current value of property minDate.

Minimum date that can be shown and selected in the Calendar. This must be a JavaScript date object.

Note: if the date is inside of a month the complete month is displayed, but dates outside the valid range can not be selected.

Note: If the minDate is set to be after the maxDate, the maxDate is set to the end of the month of the minDate.

getMonths

Gets current value of property months.

Determines the number of months displayed.

As of version 1.50, the duplicated dates are not displayed if there are multiple months.

Note: On phones, only one month is displayed.

Default value is 1.

getNonWorkingDays

Gets current value of property nonWorkingDays.

If set, the provided weekdays are displayed as non-working days. Valid values inside the array are 0 to 6. If not set, the weekend defined in the locale settings is displayed as non-working days.

Note: Keep in mind that this property sets only weekly-recurring days as non-working. If you need specific dates or dates ranges, such as national holidays, use the specialDates aggregation to set them. Both the non-working days (from property) and dates (from aggregation) are visualized the same.

getPrimaryCalendarType

Gets current value of property primaryCalendarType.

If set, the calendar type is used for display. If not set, the calendar type of the global configuration is used.

getSecondaryCalendarType

Gets current value of property secondaryCalendarType.

If set, the days are also displayed in this calendar type If not set, the dates are only displayed in the primary calendar type

getSelectedDates

Gets content of aggregation selectedDates.

Dates or date ranges for selected dates.

To set a single date (instead of a range), set only the startDate property of the sap.ui.unified.DateRange class.

getShowCurrentDateButton

Gets current value of property showCurrentDateButton.

Determines whether there is a shortcut navigation to Today. When used in Month, Year or Year-range picker view, the calendar navigates to Day picker view.

Default value is false.

getShowWeekNumbers

Gets current value of property showWeekNumbers.

Determines whether the week numbers in the months are displayed.

Note: For Islamic calendars, the week numbers are not displayed regardless of what is set to this property.

Default value is true.

getSingleSelection

Gets current value of property singleSelection.

If set, only a single date or interval, if intervalSelection is enabled, can be selected

Default value is true.

getSpecialDates

Gets content of aggregation specialDates.

Dates or date ranges with type, to visualize special days in the Calendar. If one day is assigned to more than one Type, only the first one will be used.

To set a single date (instead of a range), set only the startDate property of the sap.ui.unified.DateRange class.

Note: Keep in mind that the NonWorking type is for marking specific dates or date ranges as non-working, where if you need a weekly-reccuring non-working days (weekend), you should use the nonWorkingDays property. Both the non-working days (from property) and dates (from aggregation) are visualized the same.

getStartDate

Returns the first day of the displayed month.

There might be some days of the previous month shown, but they can not be focused.

getWidth

Gets current value of property width.

Width of Calendar

Note: There is a theme depending minimum width, so the calendar can not be set smaller.

indexOfDisabledDate

Checks for the provided sap.ui.unified.DateRange in the aggregation disabledDates. and returns its index if found or -1 otherwise.

Param Type DefaultValue Description
oDisabledDate sap.ui.unified.DateRange

The disabledDate whose index is looked for

indexOfSelectedDate

Checks for the provided sap.ui.unified.DateRange in the aggregation selectedDates. and returns its index if found or -1 otherwise.

Param Type DefaultValue Description
oSelectedDate sap.ui.unified.DateRange

The selectedDate whose index is looked for

indexOfSpecialDate

Checks for the provided sap.ui.unified.DateTypeRange in the aggregation specialDates. and returns its index if found or -1 otherwise.

Param Type DefaultValue Description
oSpecialDate sap.ui.unified.DateTypeRange

The specialDate whose index is looked for

insertDisabledDate

Inserts a disabledDate into the aggregation disabledDates.

Param Type DefaultValue Description
oDisabledDate sap.ui.unified.DateRange

The disabledDate to insert; if empty, nothing is inserted

iIndex int

The 0-based index the disabledDate should be inserted at; for a negative value of iIndex, the disabledDate is inserted at position 0; for a value greater than the current size of the aggregation, the disabledDate is inserted at the last position

insertSelectedDate

Inserts a selectedDate into the aggregation selectedDates.

Param Type DefaultValue Description
oSelectedDate sap.ui.unified.DateRange

The selectedDate to insert; if empty, nothing is inserted

iIndex int

The 0-based index the selectedDate should be inserted at; for a negative value of iIndex, the selectedDate is inserted at position 0; for a value greater than the current size of the aggregation, the selectedDate is inserted at the last position

insertSpecialDate

Inserts a specialDate into the aggregation specialDates.

Param Type DefaultValue Description
oSpecialDate sap.ui.unified.DateTypeRange

The specialDate to insert; if empty, nothing is inserted

iIndex int

The 0-based index the specialDate should be inserted at; for a negative value of iIndex, the specialDate is inserted at position 0; for a value greater than the current size of the aggregation, the specialDate is inserted at the last position

removeAllAriaLabelledBy

Removes all the controls in the association named ariaLabelledBy.

removeAllDisabledDates

Removes all the controls from the aggregation disabledDates.

Additionally, it unregisters them from the hosting UIArea.

removeAllSelectedDates

Removes all the controls from the aggregation selectedDates.

Additionally, it unregisters them from the hosting UIArea.

removeAllSpecialDates

Removes all the controls from the aggregation specialDates.

Additionally, it unregisters them from the hosting UIArea.

removeAriaLabelledBy

Removes an ariaLabelledBy from the association named ariaLabelledBy.

Param Type DefaultValue Description
vAriaLabelledBy int sap.ui.core.ID sap.ui.core.Control

The ariaLabelledBy to be removed or its index or ID

removeDisabledDate

Removes a disabledDate from the aggregation disabledDates.

Param Type DefaultValue Description
vDisabledDate int string sap.ui.unified.DateRange

The disabledDate to remove or its index or id

removeSelectedDate

Removes a selectedDate from the aggregation selectedDates.

Param Type DefaultValue Description
vSelectedDate int string sap.ui.unified.DateRange

The selectedDate to remove or its index or id

removeSpecialDate

Removes a specialDate from the aggregation specialDates.

Param Type DefaultValue Description
vSpecialDate int string sap.ui.unified.DateTypeRange

The specialDate to remove or its index or id

setFirstDayOfWeek

Sets a new value for property firstDayOfWeek.

If set, the first day of the displayed week is this day. Valid values are 0 to 6. If not a valid value is set, the default of the used locale is used.

When called with a value of null or undefined, the default value of the property will be restored.

Default value is -1.

Param Type DefaultValue Description
iFirstDayOfWeek int -1

New value for property firstDayOfWeek

setIntervalSelection

Sets a new value for property intervalSelection.

If set, interval selection is allowed

When called with a value of null or undefined, the default value of the property will be restored.

Default value is false.

Param Type DefaultValue Description
bIntervalSelection boolean false

New value for property intervalSelection

setLegend

Sets the associated legend.

Param Type DefaultValue Description
oLegend sap.ui.core.ID sap.ui.unified.CalendarLegend

ID of an element which becomes the new target of this legend association; alternatively, an element instance may be given

setMaxDate

Sets a maximum date for the calendar.

Param Type DefaultValue Description
oDate Date

a JavaScript date

setMinDate

Sets a minimum date for the calendar.

Param Type DefaultValue Description
oDate Date

a JavaScript date

setMonths

Sets a new value for property months.

Determines the number of months displayed.

As of version 1.50, the duplicated dates are not displayed if there are multiple months.

Note: On phones, only one month is displayed.

When called with a value of null or undefined, the default value of the property will be restored.

Default value is 1.

Param Type DefaultValue Description
iMonths int 1

New value for property months

setNonWorkingDays

Sets a new value for property nonWorkingDays.

If set, the provided weekdays are displayed as non-working days. Valid values inside the array are 0 to 6. If not set, the weekend defined in the locale settings is displayed as non-working days.

Note: Keep in mind that this property sets only weekly-recurring days as non-working. If you need specific dates or dates ranges, such as national holidays, use the specialDates aggregation to set them. Both the non-working days (from property) and dates (from aggregation) are visualized the same.

When called with a value of null or undefined, the default value of the property will be restored.

Param Type DefaultValue Description
sNonWorkingDays int[]

New value for property nonWorkingDays

setPrimaryCalendarType

Sets a new value for property primaryCalendarType.

If set, the calendar type is used for display. If not set, the calendar type of the global configuration is used.

When called with a value of null or undefined, the default value of the property will be restored.

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

New value for property primaryCalendarType

setSecondaryCalendarType

Sets a new value for property secondaryCalendarType.

If set, the days are also displayed in this calendar type If not set, the dates are only displayed in the primary calendar type

When called with a value of null or undefined, the default value of the property will be restored.

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

New value for property secondaryCalendarType

setShowCurrentDateButton

Sets the visibility of the Current date button in the calendar.

Param Type DefaultValue Description
bShow boolean

whether the Today button will be displayed

setShowWeekNumbers

Sets a new value for property showWeekNumbers.

Determines whether the week numbers in the months are displayed.

Note: For Islamic calendars, the week numbers are not displayed regardless of what is set to this property.

When called with a value of null or undefined, the default value of the property will be restored.

Default value is true.

Param Type DefaultValue Description
bShowWeekNumbers boolean true

New value for property showWeekNumbers

setSingleSelection

Sets a new value for property singleSelection.

If set, only a single date or interval, if intervalSelection is enabled, can be selected

When called with a value of null or undefined, the default value of the property will be restored.

Default value is true.

Param Type DefaultValue Description
bSingleSelection boolean true

New value for property singleSelection

setWidth

Sets a new value for property width.

Width of Calendar

Note: There is a theme depending minimum width, so the calendar can not be set smaller.

When called with a value of null or undefined, the default value of the property will be restored.

Param Type DefaultValue Description
sWidth sap.ui.core.CSSSize

New value for property width