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
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
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.
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
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
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
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
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
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
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
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
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
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
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
void
applyListeners
(
)
Applies the Calendar's DOM listeners to applicable elements.
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
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
Array
buildWeekdays
(
html
)
Renders the Calendar's weekday headers.
- Parameters:
-
html <Array>
The current working HTML array
- Returns:
Array
- The current working HTML array
void
clear
(
)
Clears the selected dates in the current calendar widget and sets the calendar
to the current month and year.
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
void
clearElement
(
The
)
Clears the inner HTML, CSS class and style information from the specified cell.
- Parameters:
-
The <HTMLTableCellElement>
cell to clear
- Returns:
void
void
configClose
(
)
Default handler for the "close" property
void
configIframe
(
)
Renders the built-in IFRAME shim for the IE6 and below
void
configLocale
(
)
The default handler for all configuration locale properties
void
configLocaleValues
(
)
The default handler for all configuration locale field length properties
void
configMaxDate
(
)
The default handler for the "maxdate" property
void
configMinDate
(
)
The default handler for the "mindate" property
void
configOptions
(
)
The default handler for all configuration options properties
void
configPageDate
(
)
The default handler for the "pagedate" property
void
configSelected
(
)
The default handler for the "selected" property
void
configTitle
(
)
Default handler for the "title" property
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.
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.
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.
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
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
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
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
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
Date[]
getSelectedDates
(
)
Gets the list of currently selected dates from the calendar.
- Returns:
Date[]
- An array of currently selected JavaScript Date objects.
void
hide
(
)
Hides the Calendar's outer container from view.
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
void
initEvents
(
)
Initializes Calendar's built-in CustomEvents
void
initStyles
(
)
Defines the style constants for the Calendar
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
void
nextMonth
(
)
Navigates to the next month page in the calendar widget.
void
nextYear
(
)
Navigates to the next year in the currently selected month in the calendar widget.
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.
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.
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.
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.
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.
void
onRender
(
)
Event executed when the calendar widget is rendered.
- Returns:
void
Deprecated Event handlers for this event should be susbcribed to renderEvent.
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.
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.
void
previousMonth
(
)
Navigates to the previous month page in the calendar widget.
void
previousYear
(
)
Navigates to the previous year in the currently selected month in the calendar widget.
private
void
refreshLocale
(
)
Refreshes the locale values used to build the Calendar.
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.
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
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
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
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
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
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
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
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
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
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
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
Array
renderHeader
(
html
)
Renders the calendar header.
- Parameters:
-
html <Array>
The current working HTML array
- Returns:
Array
- The current working HTML array
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
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
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
void
reset
(
)
Resets the calendar widget to the originally selected month and year, and
sets the calendar to the initial selection(s).
void
resetRenderers
(
)
Resets the render stack of the current calendar to its original pre-render value.
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.
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.
void
setMonth
(
month
)
Sets the calendar's month explicitly
- Parameters:
-
month <Number>
The numeric month, from 0 (January) to 11 (December)
- Returns:
void
void
setYear
(
year
)
Sets the calendar's year explicitly.
- Parameters:
-
year <Number>
The numeric 4-digit year
- Returns:
void
void
show
(
)
Shows the Calendar's outer container.
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
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
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
String
toString
(
)
Returns a string representation of the object.
- Returns:
String
- A string representation of the Calendar object.
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.