Search results

Calendar

Represents the Calendar component that allows the user to select a date.

<div id="calendar"/>
<script>
  var calendarObj = new Calendar({ value: new Date() });
  calendarObj.appendTo("#calendar");
</script>

Properties

depth

string

Sets the maximum level of view such as month, year, and decade in the Calendar. Depth view should be smaller than the start view to restrict its view navigation.

Defaults to Month

view
Description
Month
Calendar view shows up to the days of the month.
Year
Calendar view shows up to the months of the year.
Decade
Calendar view shows up to the years of the decade.
> For more details about depth refer to calendarViewdocumentation.

enablePersistence

boolean

Enable or disable persisting component’s state between page reloads. If enabled, following list of states will be persisted.

  1. value

Defaults to false

enableRtl

boolean

When set to true, enables RTL mode of the component that displays the content in the right-to-left direction.

Defaults to false

firstDayOfWeek

number

Gets or sets the Calendar’s first day of the week. By default, the first day of the week will be based on the current culture.

Defaults to 0

isMultiSelection

boolean

Specifies the option to enable the multiple dates selection of the calendar.

Defaults to false

locale

string

Overrides the global culture and localization value for this component. Default global culture is ‘en-US’.

Defaults to undefined

max

Date

Gets or sets the maximum date that can be selected in the Calendar.

Defaults to new Date(2099, 11, 31)

min

Date

Gets or sets the minimum date that can be selected in the Calendar.

Defaults to new Date(1900, 00, 01)

showTodayButton

boolean

Specifies whether the today button is to be displayed or not.

Defaults to true

start

string

Specifies the initial view of the Calendar when it is opened. With the help of this property, initial view can be changed to year or decade view.

Defaults to Month

View
Description
Month
Calendar view shows the days of the month.
Year
Calendar view shows the months of the year.
Decade
Calendar view shows the years of the decade.
> For more details about start refer tocalendarViewdocumentation.

value

Date

Gets or sets the selected date of the Calendar.

Defaults to null

values

Date[]

Gets or sets multiple selected dates of the calendar.

Defaults to null

weekNumber

boolean

Determines whether the week number of the year is to be displayed in the calendar or not.

Defaults to false> For more details about weekNumber refer toCalendar with week numberdocumentation.

Methods

addDate

This method is used to add the single or multiple dates to the values property of the Calendar.

Parameter Type Description
dates Date | Date[] Specifies the date or dates to be added to the values property of the Calendar.

Returns void

addEventListener

Adds the handler to the given event listener.

Returns void

appendTo

Appends the control within the given HTML element

Parameter Type Description
selector (optional) string | HTMLElement Target element where control needs to be appended

Returns void

currentView

Gets the current view of the Calendar.

Returns string

dataBind

When invoked, applies the pending property changes immediately to the component.

Returns void

destroy

Destroys the widget.

Returns void

getPersistData

Gets the properties to be maintained upon browser refresh.

Returns string

This method is used to navigate to the month/year/decade view of the Calendar.

Parameter Type Description
view string Specifies the view of the Calendar.
date Date Specifies the focused date in a view.

Returns void

refresh

Applies all the pending property changes and render the component again.

Returns void

removeDate

This method is used to remove the single or multiple dates from the values property of the Calendar.

Parameter Type Description
dates Date | Date[] Specifies the date or dates which need to be removed from the values property of the Calendar.

Returns void

removeEventListener

Removes the handler from the given event listener.

Returns void

Inject

Dynamically injects the required modules to the component.

Returns void

Events

change

EmitType<ChangedEventArgs>

Triggers when the Calendar value is changed.

created

EmitType<Object>

Triggers when Calendar is created.

destroyed

EmitType<Object>

Triggers when Calendar is destroyed.

Triggers when the Calendar is navigated to another level or within the same level of view.

renderDayCell

EmitType<RenderDayCellEventArgs>

Triggers when each day cell of the Calendar is rendered.