showDate()
shows a specified date and/or opens the calendar in one of the available modes
showDate(date?: Date, mode?: "calendar" | "month" | "year"): void;
Parameters:
date: Date
- the date that should be shown in the calendarmode: string
- optional, the mode in which the calendar will be opened
Example
calendar.showDate(new Date(2020,11,12));
Related sample: Calendar. Showing particular calendar date and mode
The modes are:
"calendar" | shows the days of a month, the default mode |
"month" | allows selecting a month of a year |
"year" | allows selecting a year |
// shows the month of the specified date
calendar.showDate(new Date(2020,11,12),"month");
// shows the current month
calendar.showDate(null,"month");
// shows the current year together with previous/next years
calendar.showDate(new Date(2020,11,12),"year");
// shows the current year
calendar.showDate(null,"year");