class CalendarViewController extends OnTimeViewController { viewDidLoad() { this.selectDay(Time.getCurrentLocalDayIndex()); } /** * Selects the given day in the date selection and displays the work time periods for that date. */ selectDay(dayIndex) { this.selectedDayIndex = dayIndex; var date = Time.getDateForLocalDayIndex(this.selectedDayIndex); var dateString = date.toLocaleDateString(undefined, { year: "numeric", month: "numeric", day: "numeric" }); var weekdayString = date.toLocaleDateString(undefined, { weekday: "long" }); this.dayNameLabel.innerText = weekdayString; this.dateLabel.innerText = dateString; this.dayViewController.displayDay(this.selectedDayIndex); } /** * Move the day selection by the given amount of days (positive or negative amount). */ selectDayRelative(days) { this.selectDay(this.selectedDayIndex + days); } onNextDayButtonPressed(event) { this.selectDayRelative(1); } onPreviousDayButtonPressed(event) { this.selectDayRelative(-1); } onSelectTodayButtonPressed(event) { this.selectDay(Time.getCurrentLocalDayIndex()); } } UIKit.registerViewControllerType(CalendarViewController);