Calendar controls
Add some additional controls, to programmatically change the calendar view and set the date.
Install
npm i @schedule-x/calendar-controls
API
setView(viewName: string)
Change the calendar view.
setDate(date: string)
Set the date of the calendar. Format: YYYY-MM-DD
.
getView(): string
Get the name of the current view.
getDate(): string
Get the currently selected date of the calendar.
getRange(): { start: string, end: string }
Get the currently visible time range of the calendar.
Examples
import { createCalendarControlsPlugin } from '@schedule-x/calendar-controls'
const calendarControls = createCalendarControlsPlugin()
const calendar = createCalendar({
// ...other configuration
plugins: [calendarControls],
})
calendar.render(/** your calendar element */)
// Programmatically change the calendar view
calendarControls.setView('week')
// Programmatically set the date
calendarControls.setDate('2025-01-01')