Calendar UI component designed for use as a date-picker, full-sized calendar or anything in-between.
Differences from component/calendar
This project is a fork from component/calendar and unless you need any of the differences listed below, it may be better to use component/calendar as a dependency in your project.
The current differences from component/calendar are as follows:
- Supports reverse list of years i.e. where
toin showYearSelect(from, to)
- Constrains calendar to one of the years in
- Uses colinf/range rather than component/range
$ component install colinf/calendar
var Calendar = require('calendar'); var cal = new Calendar; cal.el.appendTo('body');
view change(date, action) when the viewed month/year is changed without modification of the selected date. This can be done either by next/prev buttons or dropdown menu. The action will be "prev", "next", "month" or "year" depending on what action caused the view to change.
change(date) when the selected date is modified
Initialize a new
Calendar with the given
defaulting to now.
Select the given
Show the given
date. This does not select the given date,
it simply ensures that it is visible in the current view.
Add month selection input.
Add year selection input, with optional range specified by
which default to the current year -10 / +10.
Show the previous view (month).
Show the next view (month).