DatePicker

This is the constructor used to instansiate date pickers. See the usage page for typical usage and examples.

Syntax

new DatePicker([oDate])

Parameters

Name Type Descripton
oDate Date Optional. This represents the date to be selected when the date picker is created. The default value is new Date().

Static Methods

Name Descripton
No methods.

Static Fields

Name Type Descripton
days String[] This should be an array containing the letters describing the seven days of the week starting with Monday.
months String[] This should be an array containing the names of the twelwe months starting with January.

Methods

Name Descripton
create

Syntax

object.create([oDocument])

Arguments

Name Type Descripton
oDocument Document Optional.The document that the date picker should be created in. The default value is document.

Return Type

HTMLElement

This creates the HTMLElement object that represents the date picker. This element is returned.
getDate

Syntax

object.getDate()

Arguments

No Arguments.

Return Type

Date

Returns a date object representing the selected date. If no date is selected this returns null.
getFirstWeekDay

Syntax

object.getFirstWeekDay()

Arguments

No Arguments.

Return Type

Number

Returns the first day of the week
getRedWeekDay

Syntax

object.getRedWeekDay()

Arguments

No Arguments.

Return Type

Number

Returns the red day of the week
getShowNone

Syntax

object.getShowNone()

Arguments

No Arguments.

Return Type

Boolean

Returns whether the none button is visible or not.
getShowToday

Syntax

object.getShowToday()

Arguments

No Arguments.

Return Type

Boolean

Returns whether the today button is visible or not.
goToNextMonth

Syntax

object.goToNextMonth()

Arguments

No Arguments.

Return Type

void

Goes to the next month.
goToPreviousMonth

Syntax

object.goToPreviousMonth()

Arguments

No Arguments.

Return Type

void

Goes to the previous month.
goToToday

Syntax

object.goToToday()

Arguments

No Arguments.

Return Type

void

Selects todays date and shows that month in the date picker.
onchange

Syntax

object.onchange()

Arguments

No Arguments.

Return Type

void

This is the method that is called when the selected date is changed. Overload this method to receive notifications about the change.
setDate

Syntax

object.setDate(oDate)

Arguments

Name Type Descripton
oDate Date The date object describing the selected date

Return Type

void

Sets the selected date to the same date represented by the date object passed as argument. If you set the date to null then no date is selected.
setFirstWeekDay

Syntax

object.setFirstWeekDay(nFirstWeekDay)

Arguments

Name Type Descripton
nFirstWeekDay Number The first day of the week.

Return Type

void

Sets which day to show first in each week. The default value is 0 and that represents Monday according to the ISO standard.
setRedWeekDay

Syntax

object.setRedWeekDay(nRedWeekDat)

Arguments

Name Type Descripton
nRedWeekDat Number The red day of the week

Return Type

void

Sets which day of the week to be considered a red day. Default is 6 and that represents Sunday according to the ISO standard.
setShowNone

Syntax

object.setShowNone(bShowNone)

Arguments

Name Type Descripton
bShowNone Boolean Whether to show the none button or not.

Return Type

void

Sets whether the none button should be shown or not.
setShowToday

Syntax

object.setShowToday(bShowToday)

Arguments

Name Type Descripton
bShowToday Boolean Whether to show the today button or not.

Return Type

void

Sets whether the today button should be visible on the date picker.

Fields

Name Type Descripton
No fields.

Remarks

The fields leftArrowSrc and rightArrowSrc does not change the images of the button aftert the html element is created. You will have to recreate the html element to see the changes.

Date Picker
API
Demo
Download

Author: Erik Arvidsson