Moves the multi-calendar date forward by a day or by a week
depending on how many days are being shown.
goForward() {
const startDate = this.startDate;
const gapUnit = this.currViewMode.dateGapUnit;
const newDate = DateHandler.add(startDate, 1, gapUnit);
this.setStartDate(newDate);
}
Moves the multi-calendar date back by a day or by a week
depending on how many days are being shown.
goBack() {
const startDate = this.startDate;
const gapUnit = this.currViewMode.dateGapUnit;
const newDate = DateHandler.add(startDate, -1, gapUnit);
this.setStartDate(newDate);
}
Fetches data from the server for the current showing days and updates
the events.
refresh() {
this._loadEvents();
}
Option name | Type | Description |
---|---|---|
show | Boolean |
|
return |
Shows or hides Saturday and Sunday from the current calendar view.
If calendar is in mobile mode (oneDay view) it does nothing.
showWeekends(show) {
if (this.currViewMode === viewModes.oneDay) { return; }
const newView = show ? 'fullWeek' : 'weekdays';
this._setViewMode(newView);
}
Option name | Type | Description |
---|---|---|
date | String, Date | [description] |
controlBar | ControlBar | [opitonal] |
return |
Moves all calendars to a view that shows the specified date.
goToDate(date, controlBar = this.controlBar) {
if (DateHandler.isValid(date)) {
this.setStartDate(date);
} else {
controlBar.setDate(this.date);
}
}
// ====================================================
// ------------- End of Public interface --------------
// ====================================================
Option name | Type | Description |
---|---|---|
calendars | Array.<Calendar> | |
return | Int |
|
Amount of days being shown in each calendar.
getDayCount(calendars = this.calendars) {
if (calendars.length === 0) { return 0; }
return calendars[0].getDayCount();
}
Option name | Type | Description |
---|---|---|
date | DateHandler, String | |
calendars | Array.<Calendar> | [optional] |
Sets the start date of all calendars and of the control bar.
setStartDate(date, calendars = this.calendars) {
// This function may be called before a view mode is set. In this clase
// the only acceptable start date is Today.
let newDate;
if (!this.currViewMode) {
newDate = DateHandler.newDate();
} else {
const dateRange = this.currViewMode.dateRange;
newDate = DateHandler.startOf(date, dateRange);
}
for (const cal of calendars) {
cal.setStartDate(newDate);
}
this.startDate = newDate;
const daysInCalendar = this.getDayCount();
// Make sure endDate will never be negative.
// even if there are 0 days in each calendar
const daysToEnd = Math.max(daysInCalendar - 1, 0);
this.endDate = DateHandler.addDays(newDate, daysToEnd);
this.controlBar.setDate(newDate);
this._loadEvents();
}