Create a simple calendar.
component install --save nib-components/calendar
var Calendar = require('calendar');
var calendar = new Calendar();
document.body.appendChild(calendar.el);
Options:
-
selectTodayByDefault - Prevents today being selected by default leaving
selected=null
without having to call.select(null)
which fires the select event -
monthFormat - Format of the month displayed to the user in the header
-
dayOfWeekFormat - Format of the day-of-the week displayed to the user in the header
-
prevMonthNavClass
-
nextMonthNavClass
-
template - the calendar template to use
Update the calendar to display the days in the month before the current month.
Update the calendar to display the days in the month after the current month.
Check whether the user can navigate to the previous month. Default implementation always returns true
. Can be overridden to prevent navigation.
Check whether the user can navigate to the next month. Default implementation always returns true
. Can be overridden to prevent navigation.
Update the calendar to display the days in the month containing the specified date.
Select the specified date and update the calendar to display the days in the month containing the specified date.
Get the selected date formatted as per Calendar.prototype.format
.
Get the selected date as a MomentJS object.
Check whether a date is disabled according to the calendar. Default implementation always returns false
. Can be overridden to disable dates.
- requires shims for HTMLElement.classList in IE<9
- does not return dates at the start of the day, maybe it should get rid of the times from the dates?