# Yahoo! UI Library

### Calendar 2.2.2

Yahoo! UI Library > calendar > YAHOO.widget.Calendar

## Class YAHOO.widget.Calendar

Known Subclasses:
  YAHOO.widget.Calendar_Core

Calendar is the base class for the Calendar widget. In its most basic implementation, it has the ability to render a calendar widget on the page that can be manipulated to select a single date, move back and forth between months and years.

To construct the placeholder for the calendar widget, the code is as follows:

    <div id="cal1Container"></div>

Note that the table can be replaced with any kind of element.

### Constructor

YAHOO.widget.Calendar `( id , containerId , config )`

Parameters:
  `id <String>` The id of the table element that will represent the calendar widget
  `containerId <String>` The id of the container div element that will wrap the calendar table
  `config <Object>` The configuration object containing the Calendar's arguments

### Properties

#### _renderStack `- private Array`

A copy of the initial render functions created before rendering.

#### _selectedDates `- private Array`

The private list of initially selected dates.

#### browser `- String`

Returns a string representing the current browser.

#### cellDates `- Array[](Number[])`

The collection of calendar cell dates that is parallel to the cells collection. The array contains dates field arrays in the format of [YYYY, M, D].

#### cells `- HTMLTableCellElement[]`

The collection of calendar table cells

#### cfg `- YAHOO.util.Config`

The Config object used to hold the configuration variables for the Calendar

#### Config `- private Object`

The configuration object used to set up the calendars various locale and style options.
Deprecated: Configuration properties should be set by calling Calendar.cfg.setProperty.

#### domEventMap `- Object`

A map of DOM event handlers to attach to cells associated with specific CSS class names

#### id `- String`

The id that uniquely identifies this calendar. This id should match the id of the placeholder element on the page.

#### index `- Number`

The index of this item in the parent group

#### Locale `- Object`

The local object which contains the Calendar's locale settings

#### oDomContainer `- HTMLElement`

The DOM element reference that points to this calendar's container element. The calendar will be inserted into this element when the shell is rendered.

#### Options `- Object`

The local object which contains the Calendar's options

#### parent `- CalendarGroup`

The parent CalendarGroup, only to be set explicitly by the parent group

#### renderStack `- Array[]`

The list of render functions, along with required parameters, used to render cells.

#### Style.CSS_BODY `- object`

#### Style.CSS_CALENDAR `- object`

#### Style.CSS_CELL `- object`

#### Style.CSS_CELL_BOTTOM `- object`

#### Style.CSS_CELL_HIGHLIGHT1 `- object`

#### Style.CSS_CELL_HIGHLIGHT2 `- object`

#### Style.CSS_CELL_HIGHLIGHT3 `- object`

#### Style.CSS_CELL_HIGHLIGHT4 `- object`

#### Style.CSS_CELL_HOVER `- object`

#### Style.CSS_CELL_LEFT `- object`

#### Style.CSS_CELL_OOB `- object`

#### Style.CSS_CELL_OOM `- object`

#### Style.CSS_CELL_RESTRICTED `- object`

#### Style.CSS_CELL_RIGHT `- object`

#### Style.CSS_CELL_SELECTABLE `- object`

#### Style.CSS_CELL_SELECTED `- object`

#### Style.CSS_CELL_SELECTOR `- object`

#### Style.CSS_CELL_TODAY `- object`

#### Style.CSS_CELL_TOP `- object`

#### Style.CSS_CLOSE `- object`

#### Style.CSS_CONTAINER `- object`

#### Style.CSS_FOOTER `- object`

#### Style.CSS_HEADER `- object`

#### Style.CSS_HEADER_TEXT `- object`

#### Style.CSS_NAV_LEFT `- object`

#### Style.CSS_NAV_RIGHT `- object`

#### Style.CSS_ROW_FOOTER `- object`

#### Style.CSS_ROW_HEADER `- object`

#### Style.CSS_SINGLE `- object`

#### Style.CSS_WEEKDAY_CELL `- object`

#### Style.CSS_WEEKDAY_ROW `- object`

#### today `- Date`

A Date object representing today's date.

#### YAHOO.widget.Calendar._DEFAULT_CONFIG `- private static final Object`

The set of default Config property keys and values for the Calendar

#### YAHOO.widget.Calendar._EVENT_TYPES `- private static final Object`

The set of Custom Event types supported by the Calendar

#### YAHOO.widget.Calendar._STYLES `- private static final Object`

The set of default style constants for the Calendar

#### YAHOO.widget.Calendar.DATE `- static final String`

Type constant used for renderers to represent an individual date (M/D/Y)

#### YAHOO.widget.Calendar.DISPLAY_DAYS `- static final Number`

Constant that represents the total number of date cells that are displayed in a given month

#### YAHOO.widget.Calendar.IMG_ROOT `- static String`

The path to be used for images loaded for the Calendar
Deprecated: You can now customize images by overriding the calclose, calnavleft and calnavright default CSS classes for the close icon, left arrow and right arrow respectively

#### YAHOO.widget.Calendar.LONG `- static final String`

Constant used to represent long date field string formats (e.g. Monday or February)

#### YAHOO.widget.Calendar.MEDIUM `- static final String`

Constant used to represent medium date field string formats (e.g. Mon)

#### YAHOO.widget.Calendar.MONTH `- static final String`

Type constant used for renderers to represent a month across any year

#### YAHOO.widget.Calendar.MONTH_DAY `- static final String`

Type constant used for renderers to represent an individual date across any year (M/D)

#### YAHOO.widget.Calendar.ONE_CHAR `- static final String`

Constant used to represent single character date field string formats (e.g. M, T, W)

#### YAHOO.widget.Calendar.RANGE `- static final String`

Type constant used for renderers to represent a range of individual dates (M/D/Y-M/D/Y)

#### YAHOO.widget.Calendar.SHORT `- static final String`

Constant used to represent short date field string formats (e.g. Tu or Feb)

#### YAHOO.widget.Calendar.STOP_RENDER `- static final String`

Constant used for halting the execution of the remainder of the render stack

#### YAHOO.widget.Calendar.WEEKDAY `- static final String`

Type constant used for renderers to represent a weekday

### Methods

#### _addRenderer

`private void _addRenderer ( type , aDates , fnRender )`
The private method used for adding cell renderers to the local render stack. This method is called by other methods that set the renderer type prior to the method call.

Parameters:
  `type <String>` The type string that indicates the type of date renderer being added. Values are YAHOO.widget.Calendar.DATE, YAHOO.widget.Calendar.MONTH_DAY, YAHOO.widget.Calendar.WEEKDAY, YAHOO.widget.Calendar.RANGE, YAHOO.widget.Calendar.MONTH
  `aDates <Array>` An array of dates used to construct the renderer. The format varies based on the renderer type
  `fnRender <Function>` The function executed to render cells that match the render rules for this renderer.

Returns: `void`

#### _fieldArraysAreEqual

`private Boolean _fieldArraysAreEqual ( array1 , array2 )`
Converts a date field array [yyyy,mm,dd] to a JavaScript Date object.

Parameters:
  `array1 <Number[]>` The first date field array to compare
  `array2 <Number[]>` The first date field array to compare

Returns: `Boolean`
  The boolean that represents the equality of the two arrays

#### _indexOfSelectedFieldArray

`private Number _indexOfSelectedFieldArray ( find )`
Gets the index of a date field array [yyyy,mm,dd] in the current list of selected dates.

Parameters:
  `find <Number[]>` The date field array to search for

Returns: `Number`
  The index of the date field array within the collection of selected dates. -1 will be returned if the date is not found.

#### _parseDate

`private void _parseDate ( sDate )`
Converts a date string to a date field array

Parameters:
  `sDate <String>` Date string. Valid formats are mm/dd and mm/dd/yyyy.

Returns: `void`
  A date field array representing the string passed to the method

#### _parseDates

`private void _parseDates ( sDates )`
Converts a multi or single-date string to an array of date field arrays

Parameters:
  `sDates <String>` Date string with one or more comma-delimited dates. Valid formats are mm/dd, mm/dd/yyyy, mm/dd/yyyy-mm/dd/yyyy

Returns: `void`
  An array of date field arrays

#### _parsePageDate

`private Date _parsePageDate ( date )`
Parses a pagedate configuration property value. The value can either be specified as a string of form "mm/yyyy" or a Date object and is parsed into a Date object normalized to the first day of the month. If no value is passed in, the month and year from today's date are used to create the Date object

Parameters:
  `date <Date|String>` Pagedate value which needs to be parsed

Returns: `Date`
  The Date object representing the pagedate

#### _parseRange

`private void _parseRange ( startDate , endDate )`
Converts a date range to the full list of included dates

Parameters:
  `startDate <Number[]>` Date field array representing the first date in the range
  `endDate <Number[]>` Date field array representing the last date in the range

Returns: `void`
  An array of date field arrays

#### _toDate

`private Date _toDate ( dateFieldArray )`
Converts a date field array [yyyy,mm,dd] to a JavaScript Date object.

Parameters:
  `dateFieldArray <Number[]>` The date field array to convert to a JavaScript Date.

Returns: `Date`
  JavaScript Date object representing the date field array

#### _toFieldArray

`private Array[](Number[]) _toFieldArray ( date )`
Converts a date (either a JavaScript Date object, or a date string) to the internal data structure used to represent dates: [[yyyy,mm,dd],[yyyy,mm,dd]].

Parameters:
  `date <String/Date/Date[]>` The date string of dates to deselect in the current calendar. Valid formats are individual date(s) (12/24/2005,12/26/2005) or date range(s) (12/24/2005-1/1/2006). Multiple comma-delimited dates can also be passed to this method (12/24/2005,12/11/2005-12/13/2005). This method can also take a JavaScript Date object or an array of Date objects.

Returns: `Array[](Number[])`
  Array of date field arrays

#### addMonthRenderer

`void addMonthRenderer ( month , fnRender )`
Adds a month to the render stack. The function reference passed to this method will be executed when a date cell matches the month passed to this method.

Parameters:
  `month <Number>` The month (1-12) to associate with this renderer
  `fnRender <Function>` The function executed to render cells that match the render rules for this renderer.

Returns: `void`

#### addMonths

`void addMonths ( count )`
Adds the designated number of months to the current calendar month, and sets the current calendar page date to the new month.

Parameters:
  `count <Number>` The number of months to add to the current calendar

Returns: `void`

#### addRenderer

`void addRenderer ( sDates , fnRender )`
Adds a renderer to the render stack. The function reference passed to this method will be executed when a date cell matches the conditions specified in the date string for this renderer.

Parameters:
  `sDates <String>` A date string to associate with the specified renderer. Valid formats include date (12/24/2005), month/day (12/24), and range (12/1/2004-1/1/2005)
  `fnRender <Function>` The function executed to render cells that match the render rules for this renderer.

Returns: `void`

#### addWeekdayRenderer

`void addWeekdayRenderer ( weekday , fnRender )`
Adds a weekday to the render stack. The function reference passed to this method will be executed when a date cell matches the weekday passed to this method.

Parameters:
  `weekday <Number>` The weekday (0-6) to associate with this renderer
  `fnRender <Function>` The function executed to render cells that match the render rules for this renderer.

Returns: `void`

#### addYears

`void addYears ( count )`
Adds the designated number of years to the current calendar, and sets the current calendar page date to the new month.

Parameters:
  `count <Number>` The number of years to add to the current calendar

Returns: `void`

#### applyListeners

`void applyListeners ( )`
Applies the Calendar's DOM listeners to applicable elements.

Returns: `void`

#### buildDayLabel

`String buildDayLabel ( workingDate )`
Builds the date digit that will be displayed in calendar cells

Parameters:
  `workingDate <Date>` The current working date

Returns: `String`
  The formatted day label

#### buildMonthLabel

`String buildMonthLabel ( )`
Builds the date label that will be displayed in the calendar header or footer, depending on configuration.

Returns: `String`
  The formatted calendar month label

#### buildWeekdays

`Array buildWeekdays ( html )`
Renders the Calendar's weekday headers.

Parameters:
  `html <Array>` The current working HTML array

Returns: `Array`
  The current working HTML array

#### clear

`void clear ( )`
Clears the selected dates in the current calendar widget and sets the calendar to the current month and year.

Returns: `void`

#### clearAllBodyCellStyles

`void clearAllBodyCellStyles ( The )`
Removes all styles from all body cells in the current calendar table.

Parameters:
  `The <style>` CSS class name to remove from all calendar body cells

Returns: `void`

#### clearElement

`void clearElement ( The )`
Clears the inner HTML, CSS class and style information from the specified cell.

Parameters:
  `The <HTMLTableCellElement>` cell to clear

Returns: `void`

#### configClose

`void configClose ( )`
Default handler for the "close" property

Returns: `void`

#### configIframe

`void configIframe ( )`
Renders the built-in IFRAME shim for the IE6 and below

Returns: `void`

#### configLocale

`void configLocale ( )`
The default handler for all configuration locale properties

Returns: `void`

#### configLocaleValues

`void configLocaleValues ( )`
The default handler for all configuration locale field length properties

Returns: `void`

#### configMaxDate

`void configMaxDate ( )`
The default handler for the "maxdate" property

Returns: `void`

#### configMinDate

`void configMinDate ( )`
The default handler for the "mindate" property

Returns: `void`

#### configOptions

`void configOptions ( )`
The default handler for all configuration options properties

Returns: `void`

#### configPageDate

`void configPageDate ( )`
The default handler for the "pagedate" property

Returns: `void`

#### configSelected

`void configSelected ( )`
The default handler for the "selected" property

Returns: `void`

#### configTitle

`void configTitle ( )`
Default handler for the "title" property

Returns: `void`

#### deselect

`Date[] deselect ( date )`
Deselects a date or a collection of dates on the current calendar. This method, by default, does not call the render method explicitly. Once deselection has completed, render must be called for the changes to be reflected visually.

Parameters:
  `date <String/Date/Date[]>` The date string of dates to deselect in the current calendar. Valid formats are individual date(s) (12/24/2005,12/26/2005) or date range(s) (12/24/2005-1/1/2006). Multiple comma-delimited dates can also be passed to this method (12/24/2005,12/11/2005-12/13/2005). This method can also take a JavaScript Date object or an array of Date objects.

Returns: `Date[]`
  Array of JavaScript Date objects representing all individual dates that are currently selected.

#### deselectAll

`Date[] deselectAll ( )`
Deselects all dates on the current calendar.

Returns: `Date[]`
  Array of JavaScript Date objects representing all individual dates that are currently selected. Assuming that this function executes properly, the return value should be an empty array. However, the empty array is returned for the sake of being able to check the selection status of the calendar.

#### deselectCell

`Date[] deselectCell ( cellIndex )`
Deselects a date on the current calendar by referencing the index of the cell that should be deselected. This method is used to easily deselect a single cell (usually with a mouse click) without having to do a full render. The selected style is removed from the cell directly.

Parameters:
  `cellIndex <Number>` The index of the cell to deselect in the current calendar.

Returns: `Date[]`
  Array of JavaScript Date objects representing all individual dates that are currently selected.

#### doCellMouseOut

`void doCellMouseOut ( e , cal )`
The event that is executed when the user moves the mouse out of a cell

Parameters:
  `e <DOMEvent>` The event
  `cal <Calendar>` A reference to the calendar passed by the Event utility

Returns: `void`

#### doCellMouseOver

`void doCellMouseOver ( e , cal )`
The event that is executed when the user hovers over a cell

Parameters:
  `e <DOMEvent>` The event
  `cal <Calendar>` A reference to the calendar passed by the Event utility

Returns: `void`

#### doSelectCell

`void doSelectCell ( e , cal )`
The default event function that is attached to a date link within a calendar cell when the calendar is rendered.

Parameters:
  `e <DOMEvent>` The event
  `cal <Calendar>` A reference to the calendar passed by the Event utility

Returns: `void`

#### getDateByCellId

`Date getDateByCellId ( id )`
Retrieves the Date object for the specified Calendar cell

Parameters:
  `id <String>` The id of the cell

Returns: `Date`
  The Date object for the specified Calendar cell

#### getDateFieldsByCellId

`Array getDateFieldsByCellId ( id )`
Retrieves the Date object for the specified Calendar cell

Parameters:
  `id <String>` The id of the cell

Returns: `Array`
  The array of Date fields for the specified Calendar cell

#### getSelectedDates

`Date[] getSelectedDates ( )`
Gets the list of currently selected dates from the calendar.

Returns: `Date[]`
  An array of currently selected JavaScript Date objects.

#### hide

`void hide ( )`
Hides the Calendar's outer container from view.

Returns: `void`

#### init

`void init ( id , containerId , config )`
Initializes the Calendar widget.

Parameters:
  `id <String>` The id of the table element that will represent the calendar widget
  `containerId <String>` The id of the container div element that will wrap the calendar table
  `config <Object>` The configuration object containing the Calendar's arguments

Returns: `void`

#### initEvents

`void initEvents ( )`
Initializes Calendar's built-in CustomEvents

Returns: `void`

#### initStyles

`void initStyles ( )`
Defines the style constants for the Calendar

Returns: `void`

#### isDateOOM

`Boolean isDateOOM ( date )`
Determines whether a given date is OOM (out of month).

Parameters:
  `date <Date>` The JavaScript Date object for which to check the OOM status

Returns: `Boolean`
  true if the date is OOM

#### nextMonth

`void nextMonth ( )`
Navigates to the next month page in the calendar widget.

Returns: `void`

#### nextYear

`void nextYear ( )`
Navigates to the next year in the currently selected month in the calendar widget.

Returns: `void`

#### onBeforeDeselect

`void onBeforeDeselect ( )`
Event executed before a date is deselected in the calendar widget.

Returns: `void`

Deprecated Event handlers for this event should be susbcribed to beforeDeselectEvent.

#### onBeforeSelect

`void onBeforeSelect ( )`
Event executed before a date is selected in the calendar widget.

Returns: `void`

Deprecated Event handlers for this event should be susbcribed to beforeSelectEvent.

#### onChangePage

`void onChangePage ( )`
Event executed when the user navigates to a different calendar page.

Returns: `void`

Deprecated Event handlers for this event should be susbcribed to changePageEvent.

#### onClear

`void onClear ( )`
Event executed when the calendar widget is completely cleared to the current month with no selections.

Returns: `void`

Deprecated Event handlers for this event should be susbcribed to clearEvent.

#### onDeselect

`void onDeselect ( selected )`
Event executed when a date is deselected in the calendar widget.

Parameters:
  `selected <Array>` An array of date field arrays representing which date or dates were deselected. Example: [ [2006,8,6],[2006,8,7],[2006,8,8] ]

Returns: `void`

Deprecated Event handlers for this event should be susbcribed to deselectEvent.

#### onRender

`void onRender ( )`
Event executed when the calendar widget is rendered.

Returns: `void`

Deprecated Event handlers for this event should be susbcribed to renderEvent.

#### onReset

`void onReset ( )`
Event executed when the calendar widget is reset to its original state.

Returns: `void`

Deprecated Event handlers for this event should be susbcribed to resetEvemt.

#### onSelect

`void onSelect ( selected )`
Event executed when a date is selected in the calendar widget.

Parameters:
  `selected <Array>` An array of date field arrays representing which date or dates were selected. Example: [ [2006,8,6],[2006,8,7],[2006,8,8] ]

Returns: `void`

Deprecated Event handlers for this event should be susbcribed to selectEvent.

#### previousMonth

`void previousMonth ( )`
Navigates to the previous month page in the calendar widget.

Returns: `void`

#### previousYear

`void previousYear ( )`
Navigates to the previous year in the currently selected month in the calendar widget.

Returns: `void`

#### refreshLocale

`private void refreshLocale ( )`
Refreshes the locale values used to build the Calendar.

Returns: `void`

#### render

`void render ( )`
Renders the calendar after it has been configured. The render() method has a specific call chain that will execute when the method is called: renderHeader, renderBody, renderFooter. Refer to the documentation for those methods for information on individual render tasks.

Returns: `void`

#### renderBody

`Array renderBody ( workingDate , html )`
Renders the calendar body.

Parameters:
  `workingDate <Date>` The current working Date being used for the render process
  `html <Array>` The current working HTML array

Returns: `Array`
  The current working HTML array

#### renderBodyCellRestricted

`String renderBodyCellRestricted ( workingDate , cell )`
Renders the current calendar cell as a non-selectable "black-out" date using the default restricted style.

Parameters:
  `workingDate <Date>` The current working Date object being used to generate the calendar
  `cell <HTMLTableCellElement>` The current working cell in the calendar

Returns: `String`
  YAHOO.widget.Calendar.STOP_RENDER if rendering should stop with this style, null or nothing if rendering should not be terminated

#### renderCellDefault

`void renderCellDefault ( workingDate , cell )`
Renders a single standard calendar cell in the calendar widget table. All logic for determining how a standard default cell will be rendered is encapsulated in this method, and must be accounted for when extending the widget class.

Parameters:
  `workingDate <Date>` The current working Date object being used to generate the calendar
  `cell <HTMLTableCellElement>` The current working cell in the calendar

Returns: `void`

#### renderCellNotThisMonth

`String renderCellNotThisMonth ( workingDate , cell )`
Applies the default style used for rendering dates that are not a part of the current month (preceding or trailing the cells for the current month)

Parameters:
  `workingDate <Date>` The current working Date object being used to generate the calendar
  `cell <HTMLTableCellElement>` The current working cell in the calendar

Returns: `String`
  YAHOO.widget.Calendar.STOP_RENDER if rendering should stop with this style, null or nothing if rendering should not be terminated

#### renderCellStyleHighlight1

`void renderCellStyleHighlight1 ( workingDate , cell )`
Renders a single standard calendar cell using the CSS hightlight1 style

Parameters:
  `workingDate <Date>` The current working Date object being used to generate the calendar
  `cell <HTMLTableCellElement>` The current working cell in the calendar

Returns: `void`

#### renderCellStyleHighlight2

`void renderCellStyleHighlight2 ( workingDate , cell )`
Renders a single standard calendar cell using the CSS hightlight2 style

Parameters:
  `workingDate <Date>` The current working Date object being used to generate the calendar
  `cell <HTMLTableCellElement>` The current working cell in the calendar

Returns: `void`

#### renderCellStyleHighlight3

`void renderCellStyleHighlight3 ( workingDate , cell )`
Renders a single standard calendar cell using the CSS hightlight3 style

Parameters:
  `workingDate <Date>` The current working Date object being used to generate the calendar
  `cell <HTMLTableCellElement>` The current working cell in the calendar

Returns: `void`

#### renderCellStyleHighlight4

`void renderCellStyleHighlight4 ( workingDate , cell )`
Renders a single standard calendar cell using the CSS hightlight4 style

Parameters:
  `workingDate <Date>` The current working Date object being used to generate the calendar
  `cell <HTMLTableCellElement>` The current working cell in the calendar

Returns: `void`

#### renderCellStyleSelected

`String renderCellStyleSelected ( workingDate , cell )`
Applies the default style used for rendering selected dates to the current calendar cell

Parameters:
  `workingDate <Date>` The current working Date object being used to generate the calendar
  `cell <HTMLTableCellElement>` The current working cell in the calendar

Returns: `String`
  YAHOO.widget.Calendar.STOP_RENDER if rendering should stop with this style, null or nothing if rendering should not be terminated

#### renderCellStyleToday

`void renderCellStyleToday ( workingDate , cell )`
Applies the default style used for rendering today's date to the current calendar cell

Parameters:
  `workingDate <Date>` The current working Date object being used to generate the calendar
  `cell <HTMLTableCellElement>` The current working cell in the calendar

Returns: `void`

#### renderFooter

`Array renderFooter ( html )`
Renders the calendar footer. In the default implementation, there is no footer.

Parameters:
  `html <Array>` The current working HTML array

Returns: `Array`
  The current working HTML array

#### renderHeader

`Array renderHeader ( html )`
Renders the calendar header.

Parameters:
  `html <Array>` The current working HTML array

Returns: `Array`
  The current working HTML array

#### renderOutOfBoundsDate

`String renderOutOfBoundsDate ( workingDate , cell )`
Renders a cell that falls before the minimum date or after the maximum date. widget class.

Parameters:
  `workingDate <Date>` The current working Date object being used to generate the calendar
  `cell <HTMLTableCellElement>` The current working cell in the calendar

Returns: `String`
  YAHOO.widget.Calendar.STOP_RENDER if rendering should stop with this style, null or nothing if rendering should not be terminated

#### renderRowFooter

`void renderRowFooter ( weekNum , cell )`
Renders the row footer for a week.

Parameters:
  `weekNum <Number>` The week number of the current row
  `cell <Array>` The current working HTML array

Returns: `void`

#### renderRowHeader

`void renderRowHeader ( weekNum , cell )`
Renders the row header for a week.

Parameters:
  `weekNum <Number>` The week number of the current row
  `cell <Array>` The current working HTML array

Returns: `void`

#### reset

`void reset ( )`
Resets the calendar widget to the originally selected month and year, and sets the calendar to the initial selection(s).

Returns: `void`

#### resetRenderers

`void resetRenderers ( )`
Resets the render stack of the current calendar to its original pre-render value.

Returns: `void`

#### select

`Date[] select ( date )`
Selects a date or a collection of dates on the current calendar. This method, by default, does not call the render method explicitly. Once selection has completed, render must be called for the changes to be reflected visually.

Parameters:
  `date <String/Date/Date[]>` The date string of dates to select in the current calendar. Valid formats are individual date(s) (12/24/2005,12/26/2005) or date range(s) (12/24/2005-1/1/2006). Multiple comma-delimited dates can also be passed to this method (12/24/2005,12/11/2005-12/13/2005). This method can also take a JavaScript Date object or an array of Date objects.

Returns: `Date[]`
  Array of JavaScript Date objects representing all individual dates that are currently selected.

#### selectCell

`Date[] selectCell ( cellIndex )`
Selects a date on the current calendar by referencing the index of the cell that should be selected. This method is used to easily select a single cell (usually with a mouse click) without having to do a full render. The selected style is applied to the cell directly.

Parameters:
  `cellIndex <Number>` The index of the cell to select in the current calendar.

Returns: `Date[]`
  Array of JavaScript Date objects representing all individual dates that are currently selected.

#### setMonth

`void setMonth ( month )`
Sets the calendar's month explicitly

Parameters:
  `month <Number>` The numeric month, from 0 (January) to 11 (December)

Returns: `void`

#### setYear

`void setYear ( year )`
Sets the calendar's year explicitly.

Parameters:
  `year <Number>` The numeric 4-digit year

Returns: `void`

#### show

`void show ( )`
Shows the Calendar's outer container.

Returns: `void`

#### styleCellDefault

`void styleCellDefault ( workingDate , cell )`
Styles a selectable cell.

Parameters:
  `workingDate <Date>` The current working Date object being used to generate the calendar
  `cell <HTMLTableCellElement>` The current working cell in the calendar

Returns: `void`

#### subtractMonths

`void subtractMonths ( count )`
Subtracts the designated number of months from the current calendar month, and sets the current calendar page date to the new month.

Parameters:
  `count <Number>` The number of months to subtract from the current calendar

Returns: `void`

#### subtractYears

`void subtractYears ( count )`
Subtcats the designated number of years from the current calendar, and sets the current calendar page date to the new month.

Parameters:
  `count <Number>` The number of years to subtract from the current calendar

Returns: `void`

#### toString

`String toString ( )`
Returns a string representation of the object.

Returns: `String`
  A string representation of the Calendar object.

#### validate

`void validate ( )`
Validates the calendar widget. This method has no default implementation and must be extended by subclassing the widget.

Returns: `void`
  Should return true if the widget validates, and false if it doesn't.

### Events

#### beforeDeselectEvent

`beforeDeselectEvent ( )`
Fired before a selection is made

#### beforeRenderEvent

`beforeRenderEvent ( )`
Fired before the Calendar is rendered

#### beforeSelectEvent

`beforeSelectEvent ( )`
Fired before a selection is made

#### changePageEvent

`changePageEvent ( )`
Fired when the Calendar page is changed

#### clearEvent

`clearEvent ( )`
Fired when the Calendar is cleared

#### deselectEvent

`deselectEvent ( Array )`
Fired when a selection is made

Parameters:
  `Array <Array>` of Date field arrays in the format [YYYY, MM, DD].

#### renderEvent

`renderEvent ( )`
Fired when the Calendar is rendered

#### resetEvent

`resetEvent ( )`
Fired when the Calendar is reset

#### selectEvent

`selectEvent ( Array )`
Fired when a selection is made

Parameters:
  `Array <Array>` of Date field arrays in the format [YYYY, MM, DD].

### Configuration Attributes

#### close `- Boolean`

Whether or not a close button should be displayed for this Calendar
Default Value: false

#### DATE_DELIMITER `- String`

The value used to delimit individual dates in a date string passed to various Calendar functions.
Default Value: ","

#### DATE_FIELD_DELIMITER `- String`

The value used to delimit date fields in a date string passed to various Calendar functions.
Default Value: "/"

#### DATE_RANGE_DELIMITER `- String`

The value used to delimit date ranges in a date string passed to various Calendar functions.
Default Value: "-"

#### HIDE_BLANK_WEEKS `- Boolean`

True if the Calendar should suppress weeks that are not a part of the current month. False by default.
Default Value: false

#### iframe `- Boolean`

Whether or not an iframe shim should be placed under the Calendar to prevent select boxes from bleeding through in Internet Explorer 6 and below.
Default Value: true

#### LOCALE_MONTHS `- String`

The setting that determines which length of month labels should be used. Possible values are "short" and "long".
Default Value: "long"

#### LOCALE_WEEKDAYS `- String`

The setting that determines which length of weekday labels should be used. Possible values are "1char", "short", "medium", and "long".
Default Value: "short"

#### maxdate `- String`

The maximum selectable date in the current Calendar (mm/dd/yyyy)
Default Value: null

#### MD_DAY_POSITION `- Number`

The position of the day in a month/year date string
Default Value: 2

#### MD_MONTH_POSITION `- Number`

The position of the month in a month/day date string
Default Value: 1

#### MDY_DAY_POSITION `- Number`

The position of the day in a month/day/year date string
Default Value: 2

#### MDY_MONTH_POSITION `- Number`

The position of the month in a month/day/year date string
Default Value: 1

#### MDY_YEAR_POSITION `- Number`

The position of the year in a month/day/year date string
Default Value: 3

#### mindate `- String`

The minimum selectable date in the current Calendar (mm/dd/yyyy)
Default Value: null

#### MONTHS_LONG `- String[]`

The long month labels for the current locale.
Default Value: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"

#### MONTHS_SHORT `- String[]`

The short month labels for the current locale.
Default Value: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]

#### MULTI_SELECT `- Boolean`

True if the Calendar should allow multiple selections. False by default.
Default Value: false

#### MY_MONTH_POSITION `- Number`

The position of the month in a month/year date string
Default Value: 1

#### MY_YEAR_POSITION `- Number`

The position of the year in a month/year date string
Default Value: 2

#### NAV_ARROW_LEFT `- String`

The image that should be used for the left navigation arrow.
DeprecatedYou can customize the image by overriding the default CSS class for the left arrow - "calnavleft"
Default Value: null

#### NAV_ARROW_RIGHT `- String`

The image that should be used for the right navigation arrow.
DeprecatedYou can customize the image by overriding the default CSS class for the right arrow - "calnavright"
Default Value: null

#### pagedate `- String`

The month/year representing the current visible Calendar date (mm/yyyy)
Default Value: today's date

#### selected `- String`

The date or range of dates representing the current Calendar selection
Default Value: []

#### SHOW_WEEK_FOOTER `- Boolean`

True if the Calendar should show week row footers. False by default.
Default Value: false

#### SHOW_WEEK_HEADER `- Boolean`

True if the Calendar should show week row headers. False by default.
Default Value: false

#### SHOW_WEEKDAYS `- Boolean`

True if the Calendar should show weekday labels. True by default.
Default Value: true

#### START_WEEKDAY `- number`

The weekday the week begins on. Default is 0 (Sunday).
Default Value: 0

#### title `- String`

The title to display above the Calendar's month header
Default Value: ""

#### WEEKDAYS_1CHAR `- String[]`

The 1-character weekday labels for the current locale.
Default Value: ["S", "M", "T", "W", "T", "F", "S"]

#### WEEKDAYS_LONG `- String[]`

The long weekday labels for the current locale.
Default Value: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]

#### WEEKDAYS_MEDIUM `- String[]`

The medium weekday labels for the current locale.
Default Value: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"]

#### WEEKDAYS_SHORT `- String[]`

The short weekday labels for the current locale.
Default Value: ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"]

Copyright © 2007 Yahoo! Inc. All rights reserved.