DatePicker Class

Calendar component used select dates

Constructors

DatePicker( parent, config )
Used to instantiate this class
parentDOM element in which to render this component
configConfiguration settings (optional). See config options for more information.

Config Options

date
Used to set the initial view. All we need is a month and a year.
selectionMode
Used to set the selection mode. Options are "day" or "week".
daysOfWeek
Day names or abbreviations to use in the column headers
months
Month names or abbreviations used in the header
allowDeselect
If true, allows users to deselect the current selection via mouse click
style
Style for individual elements within the component. Note that you can provide CSS class names instead of individual style definitions.

Events

onClick( date, dateRange )
Called when a cell in the calendar is clicked.
dateDate associated with the cell.
dateRangeAn array representing the selected date range. If the selection mode is set to "week", the array will contain two entries: one for the start date and one for the end date. Otherwise, the array will contain only one entry.
onHeaderClick( headerDiv, e )
Called when the calendar title is clicked. Typically used to render a month and year selection menu.
onUpdate( date )
Called when the date picker is first rendered or whenever the month is changed.

Public Methods

setDate( date )
Used to update the calendar and select the given date.
render( date )
Used to update the calendar and render a given date.
select( date )
Used to select a cell that corresponds to the given date. If the selectionMode is set to week, an entire row will be selected.
deselect( )
Used to deselect any selected cells in the calendar.
getSelectionMode( )
setSelectionMode( str )
getSelectedCells( )
back( )
Used to render the previous month.
next( )
Used to render the next month.
getMonth( )
Returns the month rendered in the date picker (0-11)
getYear( )
Returns the year rendered in the date picker.