# Yahoo! UI Library

### Calendar 2.8.2r1

Yahoo! UI Library > calendar > YAHOO.widget.Calendar
Search:
Filters
Show Private Show Protected Show Deprecated

## 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="calContainer"></div>

NOTE: As of 2.4.0, the constructor's ID argument is optional. The Calendar can be constructed by simply providing a container ID string, or a reference to a container DIV HTMLElement (the element needs to exist in the document). E.g.:

    var c = new YAHOO.widget.Calendar("calContainer", configOptions);

or:

    var containerDiv = YAHOO.util.Dom.get("calContainer");
    var c = new YAHOO.widget.Calendar(containerDiv, configOptions);

If not provided, the ID will be generated from the container DIV ID by adding an "_t" suffix. For example if an ID is not provided, and the container's ID is "calContainer", the Calendar's ID will be set to "calContainer_t".

### Constructor

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

Parameters:
  `id <String>` optional The id of the table element that will represent the Calendar widget. As of 2.4.0, this argument is optional.
  `container <String | HTMLElement>` The id of the container div element that will wrap the Calendar table, or a reference to a DIV element which exists in the document.
  `config <Object>` optional The configuration object containing the initial configuration values for the Calendar.

### 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.
Deprecated: As of 2.3.0, environment information is available in YAHOO.env.ua

#### 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.

#### containerId - `String`

The unique id associated with the Calendar's container

#### 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.

#### 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.

#### oNavigator - `CalendarNavigator`

A reference to the CalendarNavigator instance created for this Calendar. Will be null if the "navigator" configuration property has not been set

#### 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_FIXED_SIZE - `object`

#### Style.CSS_FOOTER - `object`

#### Style.CSS_HEADER - `object`

#### Style.CSS_HEADER_TEXT - `object`

#### Style.CSS_LINK_CLOSE - `object`

#### Style.CSS_NAV - `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`

#### Style.CSS_WITH_TITLE - `object`

#### today - `Date`

A Date object representing today's date.
Deprecated: Use the "today" configuration property

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

The set of default Config property keys and values for the Calendar
Deprecated: Made public. See the public DEFAULT_CONFIG property for details

#### 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
Deprecated: Made public. See the public STYLES property for details

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

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

#### YAHOO.widget.Calendar.DEFAULT_CONFIG - `static Object`

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

NOTE: This property is made public in order to allow users to change the default values of configuration properties. Users should not modify the key string, unless they are overriding the Calendar implementation

The property is an object with key/value pairs, the key being the uppercase configuration property name and the value being an object literal with a key string property, and a value property, specifying the default value of the property. To override a default value, you can set the value property, for example, `YAHOO.widget.Calendar.DEFAULT_CONFIG.MULTI_SELECT.value = true;`

#### 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.STYLES - `static Object An object with name/value pairs for the class name identifier/value.`

The set of default style constants for the Calendar

#### 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.

#### _buildMonthLabel

`private String _buildMonthLabel ( date )`
Helper method, to format a Month Year string, given a JavaScript Date, based on the Calendar localization settings

Parameters:
  `date <Date>`

Returns: `String`
  Formated month, year string

#### _fieldArraysAreEqual

`private Boolean _fieldArraysAreEqual ( array1 , array2 )`
Determines if 2 field arrays are equal.

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.

#### _parseArgs

`protected Object _parseArgs ( Function )`
Protected helper used to parse Calendar constructor/init arguments. As of 2.4.0, Calendar supports a simpler constructor signature. This method reconciles arguments received in the pre 2.4.0 and 2.4.0 formats.

Parameters:
  `Function <Array>` "arguments" array

Returns: `Object`
  Object with id, container, config properties containing the reconciled argument values.

#### _parseDate

`private _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: ``
  A date field array representing the string passed to the method

#### _parseDates

`private _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: ``
  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 _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: ``
  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

Deprecated Made public, toDate

#### _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.

#### 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

#### 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.

#### 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 (Sunday = 1, Monday = 2 ... Saturday = 7) to associate with this renderer
  `fnRender <Function>` The function executed to render cells that match the render rules for this renderer.

#### 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

#### applyListeners

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

#### 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.

#### clearAllBodyCellStyles

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

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

#### clearElement

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

Parameters:
  `cell <HTMLTableCellElement>` The cell to clear

#### configClose

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

#### configIframe

`void configIframe ( )`
Default Config listener for the iframe property. If the iframe config property is set to true, renders the built-in IFRAME shim if the container is relatively or absolutely positioned.

#### configLocale

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

#### configLocaleValues

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

#### configMaxDate

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

#### configMinDate

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

#### configNavigator

`void configNavigator ( )`
The default handler for the "navigator" property

#### configOptions

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

#### configPageDate

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

#### configSelected

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

#### configStrings

`void configStrings ( )`
The default handler for the "strings" property

#### configTitle

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

#### configToday

`void configToday ( )`
The default handler for the "today" property

#### createCloseButton

`createCloseButton ( )`
Creates the close button HTML element and adds it to Calendar container DIV

Returns: ``
  The close HTML element created

#### createTitleBar

`createTitleBar ( strTitle )`
Creates the title bar element and adds it to Calendar container DIV

Parameters:
  `strTitle <String>` The title to display in the title bar

Returns: ``
  The title bar element

#### 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. The method will not attempt to deselect any dates which are OOB (out of bounds, and hence not selectable) and the array of deselected dates passed to the deselectEvent will not contain any OOB dates. If all dates are OOB, beforeDeselect and deselect events will not be fired.

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. If the cell is not marked with the CSS_CELL_SELECTABLE class (as is the case by default for out of month or out of bounds cells), the method will not attempt to deselect it and in such a case, beforeDeselect and deselect events will not be fired.

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.

#### destroy

`void destroy ( )`
Destroys the Calendar instance. The method will remove references to HTML elements, remove any event listeners added by the Calendar, and destroy the Config and CalendarNavigator instances it has created.

#### 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

#### 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

#### doNextMonthNav

`void doNextMonthNav ( e , cal )`
The default event handler for clicks on the "Next Month" navigation UI

Parameters:
  `e <DOMEvent>` The DOM event
  `cal <Calendar>` A reference to the calendar

#### doPreviousMonthNav

`void doPreviousMonthNav ( e , cal )`
The default event handler for clicks on the "Previous Month" navigation UI

Parameters:
  `e <DOMEvent>` The DOM event
  `cal <Calendar>` A reference to the calendar

#### doSelectCell

`void doSelectCell ( e , cal )`
The default event handler for date cell selection. Currently attached to the Calendar's bounding box, referenced by it's oDomContainer property.

Parameters:
  `e <DOMEvent>` The DOM event
  `cal <Calendar>` A reference to the calendar

#### getCellIndex

`Number getCellIndex ( date )`
Find the Calendar's cell index for a given date. If the date is not found, the method returns -1.

The returned index can be used to lookup the cell HTMLElement using the Calendar's cells array or passed to selectCell to select cells by index.

See cells, selectCell.

Parameters:
  `date <Date>` JavaScript Date object, for which to find a cell index.

Returns: `Number`
  The index of the date in Calendars cellDates/cells arrays, or -1 if the date is not on the curently rendered Calendar page.

#### 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

#### getIndexFromId

`Number getIndexFromId ( strId )`
Given the id used to mark each Calendar cell, this method extracts the index number from the id.

Parameters:
  `strId <String>` The cell id

Returns: `Number`
  The index of the cell, or -1 if id does not contain an index number

#### 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.

#### init

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

Parameters:
  `id <String>` optional The id of the table element that will represent the Calendar widget. As of 2.4.0, this argument is optional.
  `container <String | HTMLElement>` The id of the container div element that will wrap the Calendar table, or a reference to a DIV element which exists in the document.
  `config <Object>` optional The configuration object containing the initial configuration values for the Calendar.

#### initEvents

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

#### initStyles

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

#### isDateOOB

`Boolean isDateOOB ( date )`
Determines whether a given date is OOB (out of bounds - less than the mindate or more than the maxdate).

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

Returns: `Boolean`
  true if the date is OOB

#### 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.

#### nextYear

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

#### onBeforeDeselect

`void onBeforeDeselect ( )`
Event executed before a date is deselected in the calendar widget.
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.
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.
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.
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] ]

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

#### onRender

`void onRender ( )`
Event executed when the calendar widget is rendered.
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.
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] ]

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

#### previousMonth

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

#### previousYear

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

#### refreshLocale

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

#### removeCloseButton

`void removeCloseButton ( )`
Removes the close button HTML element from the DOM

#### removeRenderers

`void removeRenderers ( )`
Removes all custom renderers added to the Calendar through the addRenderer, addMonthRenderer and addWeekdayRenderer methods. Calendar's render method needs to be called after removing renderers to re-render the Calendar without custom renderers applied.

#### removeTitleBar

`void removeTitleBar ( )`
Removes the title bar element from the DOM

#### 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.

#### 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

#### 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

#### 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

#### 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

#### 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

#### 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

#### 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

#### 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

#### reset

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

#### resetRenderers

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

#### 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. Any dates which are OOB (out of bounds, not selectable) will not be selected and the array of selected dates passed to the selectEvent will not contain OOB dates. If all dates are OOB, the no state change will occur; beforeSelect and select events will not be fired.

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. If the cell is not marked with the CSS_CELL_SELECTABLE class (as is the case by default for out of month or out of bounds cells), it will not be selected and in such a case beforeSelect and select events will not be fired.

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)

#### setYear

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

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

#### show

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

#### 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

#### 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

#### 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

#### toDate

`Date toDate ( dateFieldArray )`
Converts a date field array [yyyy,mm,dd] to a JavaScript Date object. The date field array is the format in which dates are as provided as arguments to selectEvent and deselectEvent listeners.

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

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

#### toString

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

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

#### validate

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

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

### Events

#### beforeDeselectEvent

`beforeDeselectEvent ( )`
Fired before a date or set of dates is deselected

#### beforeDestroyEvent

`beforeDestroyEvent ( )`
Fired just before the Calendar is to be destroyed

#### beforeHideEvent

`beforeHideEvent ( )`
Fired just before the Calendar is to be hidden

#### beforeHideNavEvent

`beforeHideNavEvent ( )`
Fired just before the CalendarNavigator is to be hidden

#### beforeRenderEvent

`beforeRenderEvent ( )`
Fired before the Calendar is rendered

#### beforeRenderNavEvent

`beforeRenderNavEvent ( )`
Fired just before the CalendarNavigator is to be rendered

#### beforeSelectEvent

`beforeSelectEvent ( )`
Fired before a date selection is made

#### beforeShowEvent

`beforeShowEvent ( )`
Fired just before the Calendar is to be shown

#### beforeShowNavEvent

`beforeShowNavEvent ( )`
Fired just before the CalendarNavigator is to be shown

#### changePageEvent

`changePageEvent ( prevDate , newDate )`
Fired when the Calendar page is changed

Parameters:
  `prevDate <Date>` The date before the page was changed
  `newDate <Date>` The date after the page was changed

#### clearEvent

`clearEvent ( )`
Fired when the Calendar is cleared

#### deselectEvent

`deselectEvent ( Array )`
Fired when a date or set of dates is deselected

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

#### destroyEvent

`destroyEvent ( )`
Fired after the Calendar is destroyed. This event should be used for notification only. When this event is fired, important Calendar instance properties, dom references and event listeners have already been removed/dereferenced, and hence the Calendar instance is not in a usable state.

#### hideEvent

`hideEvent ( )`
Fired after the Calendar is hidden

#### hideNavEvent

`hideNavEvent ( )`
Fired after the CalendarNavigator is hidden

#### renderEvent

`renderEvent ( )`
Fired when the Calendar is rendered

#### renderNavEvent

`renderNavEvent ( )`
Fired after the CalendarNavigator is rendered

#### resetEvent

`resetEvent ( )`
Fired when the Calendar is reset

#### selectEvent

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

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

#### showEvent

`showEvent ( )`
Fired after the Calendar is shown

#### showNavEvent

`showNavEvent ( )`
Fired after the CalendarNavigator is shown

### 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. This property is enabled by default for IE6 and below. It is disabled by default for other browsers for performance reasons, but can be enabled if required.
Default Value: true for IE6 and below, false for all other browsers

#### 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 | Date`

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 | Date`

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_LABEL_MONTH_POSITION `- Number`

The position of the month in the month year label string used as the Calendar header
Default Value: 1

#### MY_LABEL_MONTH_SUFFIX `- String`

The suffix used after the month when rendering the Calendar header
Default Value: " "

#### MY_LABEL_YEAR_POSITION `- Number`

The position of the year in the month year label string used as the Calendar header
Default Value: 2

#### MY_LABEL_YEAR_SUFFIX `- String`

The suffix used after the year when rendering the Calendar header
Default Value: ""

#### 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.
Deprecated You 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.
Deprecated You can customize the image by overriding the default CSS class for the right arrow - "calnavright"
Default Value: null

#### navigator `- {Object|Boolean}`

Configuration for the Month/Year CalendarNavigator UI which allows the user to jump directly to a specific Month/Year without having to scroll sequentially through months.

Setting this property to null (default value) or false, will disable the CalendarNavigator UI.

Setting this property to true will enable the CalendarNavigatior UI with the default CalendarNavigator configuration values.

This property can also be set to an object literal containing configuration properties for the CalendarNavigator UI. The configuration object expects the the following case-sensitive properties, with the "strings" property being a nested object. Any properties which are not provided will use the default values (defined in the CalendarNavigator class).

strings
  Object : An object with the properties shown below, defining the string labels to use in the Navigator's UI
  month
    String : The string to use for the month label. Defaults to "Month".
  year
    String : The string to use for the year label. Defaults to "Year".
  submit
    String : The string to use for the submit button label. Defaults to "Okay".
  cancel
    String : The string to use for the cancel button label. Defaults to "Cancel".
  invalidYear
    String : The string to use for invalid year values. Defaults to "Year needs to be a number".
monthFormat
  String : The month format to use. Either YAHOO.widget.Calendar.LONG, or YAHOO.widget.Calendar.SHORT. Defaults to YAHOO.widget.Calendar.LONG
initialFocus
  String : Either "year" or "month" specifying which input control should get initial focus. Defaults to "year"

E.g.

    var navConfig = {
    strings: {
    month:"Calendar Month",
    year:"Calendar Year",
    submit: "Submit",
    cancel: "Cancel",
    invalidYear: "Please enter a valid year"
    },
    monthFormat: YAHOO.widget.Calendar.SHORT,
    initialFocus: "month"
    }

Default Value: null

#### pagedate `- String | Date`

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 = 0, Monday = 1 ... Saturday = 6).
Default Value: 0

#### strings `- {Object}`

The map of UI strings which the Calendar UI uses.
Default Value: An object with the properties shown below:

previousMonth
  String : The string to use for the "Previous Month" navigation UI. Defaults to "Previous Month".
nextMonth
  String : The string to use for the "Next Month" navigation UI. Defaults to "Next Month".
close
  String : The string to use for the close button label. Defaults to "Close".

#### title `- String`

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

#### today `- Date`

The date to use to represent "Today".
Default Value: The client side date (new Date()) when the Calendar is instantiated.

#### 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"]

#### YEAR_OFFSET `- Number`

The positive or negative year offset from the Gregorian calendar year (assuming a January 1st rollover) to be used when displaying and parsing dates. NOTE: All JS Date objects returned by methods, or expected as input by methods will always represent the Gregorian year, in order to maintain date/month/week values.
Default Value: 0

Copyright © 2010 Yahoo! Inc. All rights reserved.