Create the datepicker plugin.
Sets an input field to popup a calendar for date entry,
or a div
or span
to show an inline calendar.
Expects HTML like:
<input type="text">
or
<div></div>
Provide inline configuration like:
<input type="text" data-datepick="name: 'value',..."/>
- Source:
Example
$(selector).datepick()
$(selector).datepick({minDate: 0, maxDate: '+1m +1w'})
Extends
- JQPlugin
Members
(inner) ATOM
The
date format
for use with Atom (RFC 3339/ISO 8601): yyyy-mm-dd.
- Source:
(inner) commands
Command actions that may be added to a layout by name.
- prev - Show the previous month (based on
monthsToStep
option) - PageUp - prevJump - Show the previous year (based on
monthsToJump
option) - Ctrl+PageUp - next - Show the next month (based on
monthsToStep
option) - PageDown - nextJump - Show the next year (based on
monthsToJump
option) - Ctrl+PageDown - current - Show the currently selected month or today's if none selected - Ctrl+Home
- today - Show today's month - Ctrl+Home
- clear - Erase the date and close the datepicker popup - Ctrl+End
- close - Close the datepicker popup - Esc
- prevWeek - Move the cursor to the previous week - Ctrl+Up
- prevDay - Move the cursor to the previous day - Ctrl+Left
- nextDay - Move the cursor to the next day - Ctrl+Right
- nextWeek - Move the cursor to the next week - Ctrl+Down
Properties:
Name | Type | Description | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
text |
string | The field in the regional settings for the displayed text. | |||||||||||||||
status |
string | The field in the regional settings for the status text. | |||||||||||||||
keystroke |
object | The keystroke to trigger the action.
Properties
|
|||||||||||||||
enabled |
DatepickCommandEnabled | The function that indicates the command is enabled. | |||||||||||||||
date |
DatepickCommandDate | The function to get the date associated with this action. | |||||||||||||||
action |
DatepickCommandAction | The function that implements the action. |
- Source:
(inner) COOKIE
The
date format
for use with cookies: D, dd M yyyy.
- Source:
(inner) defaultOptions
Default settings for the plugin.
Properties:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
pickerClass |
string |
<optional> |
'' | CSS class to add to this instance of the datepicker. |
showOnFocus |
boolean |
<optional> |
true | true for popup on focus, false for not. |
showTrigger |
string | Element | jQuery |
<optional> |
null | Element to be cloned for a trigger,
null for none. |
showAnim |
string |
<optional> |
'show' | Name of jQuery animation for popup, '' for no animation. |
showOptions |
object |
<optional> |
null | Options for enhanced animations. |
showSpeed |
string | number |
<optional> |
'normal' | Duration of display/closure, named value or milliseconds. |
popupContainer |
string | Element | jQuery |
<optional> |
null | The element to which a popup calendar is added,
null for body. |
alignment |
string |
<optional> |
'bottom' | Alignment of popup - with nominated corner of input: 'top' or 'bottom' aligns depending on language direction, 'topLeft', 'topRight', 'bottomLeft', 'bottomRight'. |
fixedWeeks |
boolean |
<optional> |
false | true to always show 6 weeks,
false to only show as many as are needed. |
firstDay |
number |
<optional> |
0 | First day of the week, 0 = Sunday, 1 = Monday, etc. |
calculateWeek |
DatepickCalculateWeek |
<optional> |
this.iso8601Week | Calculate week of the year from a date,
null for ISO8601. |
monthsToShow |
number | Array.<number> |
<optional> |
1 | How many months to show, cols or [rows, cols]. |
monthsOffset |
number | DatepickMonthsOffset |
<optional> |
0 | How many months to offset the primary month by; may be a function that takes the date and returns the offset. |
monthsToStep |
number |
<optional> |
1 | How many months to move when prev/next clicked. |
monthsToJump |
number |
<optional> |
12 | How many months to move when large prev/next clicked. |
useMouseWheel |
boolean |
<optional> |
true | true to use mousewheel if available,
false to never use it. |
changeMonth |
boolean |
<optional> |
true | true to change month/year via drop-down,
false for navigation only. |
yearRange |
string |
<optional> |
'c-10:c+10' | Range of years to show in drop-down: 'any' for direct text entry or 'start:end', where start/end are '±nn' for relative to today or 'c±nn' for relative to the currently selected date or 'nnnn' for an absolute year. |
shortYearCutoff |
string | number |
<optional> |
'+10' | Cutoff for two-digit year in the current century. If expressed as a string it is offset from the current year. If expressed as a number it is used directly. Use -1 to always use 1900 as the base year, or use 100 to disable the functionality. Any short year ('yy') entered is transformed into a full year in the current century if less than or equal to this cutoff value, and the previous century otherwise. |
showOtherMonths |
boolean |
<optional> |
false | true to show dates from other months,
false to not show them. |
selectOtherMonths |
boolean |
<optional> |
false | true to allow selection of dates
from other months too. |
defaultDate |
string | number | Date |
<optional> |
null | Date to show if no other selected.
If expressed as a string it is parsed using the current
dateFormat .
If expressed as a number it is offset that number of days from today.
If expressed as a Date it is used directly. |
selectDefaultDate |
boolean |
<optional> |
false | true to pre-select the default date
if no other is chosen. |
minDate |
string | number | Date |
<optional> |
null | The minimum selectable date.
See the allowed values in defaultDate above. |
maxDate |
string | number | Date |
<optional> |
null | The maximum selectable date.
See the allowed values in defaultDate above. |
dateFormat |
string |
<optional> |
'mm/dd/yyyy' | Format for dates.
See formatDate for allowed formats. |
autoSize |
boolean |
<optional> |
false | true to size the input field according to
the dateFormat . |
rangeSelect |
boolean |
<optional> |
false | Allows for selecting a date range on one date picker. |
rangeSeparator |
string |
<optional> |
' - ' | Text between two dates in a range when displayed. |
multiSelect |
number |
<optional> |
0 | Maximum number of selectable dates for multiple independent dates,
zero for single select. If specified,
multiSelect takes precedence over rangeSelect . |
multiSeparator |
string |
<optional> |
',' | Text between multiple dates. |
onDate |
DatepickOnDate |
<optional> |
null | Callback as each date is added to the display calendar. This allows you to customise the behaviour and presentation of each date. |
onShow |
DatepickOnShow |
<optional> |
null | Callback just before a datepicker is shown. This allows you to customise the datepicker before display. |
onChangeMonthYear |
DatepickOnChangeMonthYear |
<optional> |
null | Callback when a new month/year is selected. This allows you to perform other actions when the calendar changes. |
onSelect |
DatepickOnSelect |
<optional> |
null | Callback when a date is selected. |
onClose |
DatepickOnClose |
<optional> |
null | Callback when a datepicker is closed. |
altField |
string | Element | jQuery |
<optional> |
null | Alternate field to update in synch with the datepicker. |
altFormat |
string |
<optional> |
null | Date format for alternate field, defaults to
dateFormat .
This allows you to display one (human-friendly) format,
while automatically maintaining another (computer-friendly) format. |
constrainInput |
boolean |
<optional> |
true | true to constrain typed input to
dateFormat allowed characters. |
commandsAsDateFormat |
boolean |
<optional> |
false | true to apply
formatDate to the command texts. |
commands |
object |
<optional> |
this.commands | Command actions that may be added to a layout by name. |
- Source:
(inner) defaultRenderer
Default template for generating a datepicker.
Insert anywhere: '{l10n:name}' to insert localised value for name,
'{link:name}' to insert a link trigger for command name,
'{button:name}' to insert a button trigger for command name,
'{popup:start}...{popup:end}' to mark a section for inclusion in a popup datepicker only,
'{inline:start}...{inline:end}' to mark a section for inclusion in an inline datepicker only.
Properties:
Name | Type | Description |
---|---|---|
picker |
string | Overall structure: '{months}' to insert calendar months. |
monthRow |
string | One row of months: '{months}' to insert calendar months. |
month |
string | A single month: '{monthHeader:dateFormat}' to insert the month header - dateFormat is optional and defaults to 'MM yyyy', '{weekHeader}' to insert a week header, '{weeks}' to insert the month's weeks. |
weekHeader |
string | A week header: '{days}' to insert individual day names. |
dayHeader |
string | Individual day header: '{day}' to insert day name. |
week |
string | One week of the month: '{days}' to insert the week's days, '{weekOfYear}' to insert week of year. |
day |
string | An individual day: '{day}' to insert day value. |
monthSelector |
string | jQuery selector, relative to picker, for a single month. |
daySelector |
string | jQuery selector, relative to picker, for individual days. |
rtlClass |
string | Class for right-to-left (RTL) languages. |
multiClass |
string | Class for multi-month datepickers. |
defaultClass |
string | Class for selectable dates. |
selectedClass |
string | Class for currently selected dates. |
highlightedClass |
string | Class for highlighted dates. |
todayClass |
string | Class for today. |
otherMonthClass |
string | Class for days from other months. |
weekendClass |
string | Class for days on weekends. |
commandClass |
string | Class prefix for commands. |
commandButtonClass |
string | Extra class(es) for commands that are buttons. |
commandLinkClass |
string | Extra class(es) for commands that are links. |
disabledClass |
string | Class for disabled commands. |
- Source:
(inner) FULL
The
date format
for full display: DD, MM d, yyyy.
- Source:
(inner) ISO_8601
The
date format
for use with ISO 8601: yyyy-mm-dd.
- Source:
(inner) JULIAN
The
date format
for Julian dates: J.
- Source:
(inner) name
The name of the plugin.
- Default Value:
- 'datepick'
- Source:
(inner) regionalOptions
Localisations for the plugin.
Entries are objects indexed by the language code ('' being the default US/English).
Each object has the following attributes.
Properties:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
monthNames |
Array.<string> |
<optional> |
['January','February',...,'November','December'] | The long names of the months. |
monthNamesShort |
Array.<string> |
<optional> |
['Jan','Feb',...,'Nov','Dec'] | The short names of the months. |
dayNames |
Array.<string> |
<optional> |
['Sunday','Monday',...,'Friday','Saturday'] | The long names of the days of the week. |
dayNamesShort |
Array.<string> |
<optional> |
['Sun','Mon','Tue','Wed','Thu','Fri','Sat'] | The short names of the days of the week. |
dayNamesMin |
Array.<string> |
<optional> |
['Su','Mo','Tu','We','Th','Fr','Sa'] | The minimal names of the days of the week. |
dateFormat |
string |
<optional> |
'mm/dd/yyyy' | See options on formatDate . |
firstDay |
number |
<optional> |
0 | The first day of the week, Sun = 0, Mon = 1, etc. |
renderer |
string |
<optional> |
this.defaultRenderer | The rendering templates. |
prevText |
string |
<optional> |
'<Prev' | Text for the previous month command. |
prevStatus |
string |
<optional> |
'Show the previous month' | Status text for the previous month command. |
prevJumpText |
string |
<optional> |
'<<' | Text for the previous year command. |
prevJumpStatus |
string |
<optional> |
'Show the previous year' | Status text for the previous year command. |
nextText |
string |
<optional> |
'Next>' | Text for the next month command. |
nextStatus |
string |
<optional> |
'Show the next month' | Status text for the next month command. |
nextJumpText |
string |
<optional> |
'>>' | Text for the next year command. |
nextJumpStatus |
string |
<optional> |
'Show the next year' | Status text for the next year command. |
currentText |
string |
<optional> |
'Current' | Text for the current month command. |
currentStatus |
string |
<optional> |
'Show the current month' | Status text for the current month command. |
todayText |
string |
<optional> |
'Today' | Text for the today's month command. |
todayStatus |
string |
<optional> |
'Show today\'s month' | Status text for the today's month command. |
clearText |
string |
<optional> |
'Clear' | Text for the clear command. |
clearStatus |
string |
<optional> |
'Clear all the dates' | Status text for the clear command. |
closeText |
string |
<optional> |
'Close' | Text for the close command. |
closeStatus |
string |
<optional> |
'Close the datepicker' | Status text for the close command. |
yearStatus |
string |
<optional> |
'Change the year' | Status text for year selection. |
earlierText |
string |
<optional> |
'  ▲' | Text for earlier years. |
laterText |
string |
<optional> |
'  ▼' | Text for later years. |
monthStatus |
string |
<optional> |
'Change the month' | Status text for month selection. |
weekText |
string |
<optional> |
'Wk' | Text for week of the year column header. |
weekStatus |
string |
<optional> |
'Week of the year' | Status text for week of the year column header. |
dayStatus |
string |
<optional> |
'Select DD, M d, yyyy' | Status text for selectable days. |
defaultStatus |
string |
<optional> |
'Select a date' | Status text shown by default. |
isRTL |
boolean |
<optional> |
false | true if language is written right-to-left. |
- Source:
(inner) RFC_822
The
date format
for use with RFC 822: D, d M yy.
- Source:
(inner) RFC_850
The
date format
for use with RFC 850: DD, dd-M-yy.
- Source:
(inner) RFC_1036
The
date format
for use with RFC 1036: D, d M yy.
- Source:
(inner) RFC_1123
The
date format
for use with RFC 1123: D, d M yyyy.
- Source:
(inner) RFC_2822
The
date format
for use with RFC 2822: D, d M yyyy.
- Source:
(inner) RSS
The
date format
for use with RSS (RFC 822): D, d M yy.
- Source:
(inner) TICKS
The
date format
for Windows ticks: !.
- Source:
(inner) TIMESTAMP
The
date format
for Unix timestamp: @.
- Source:
(inner) W3C
The
date format
for use with W3C (ISO 8601): yyyy-mm-dd.
- Source:
Methods
(inner) add(date, amount, period) → {Date}
Add a number of periods to a date.
Parameters:
Name | Type | Description |
---|---|---|
date |
Date | The original date. |
amount |
number | The number of periods. |
period |
string | The type of period 'd' for days, 'w' for weeks, 'm' for months, 'y' for years. |
- Source:
Returns:
The updated date.
- Type
- Date
Example
$.datepick.add(date, 10, 'd')
(inner) changeDay(elem, offset)
Adjust the currently shown day.
Parameters:
Name | Type | Description |
---|---|---|
elem |
Element | The control to affect. |
offset |
number | The number of days to change by. |
- Source:
Example
$(selector).datepick('changeDay', 7)
(inner) changeMonth(elem, offset)
Adjust the currently shown month.
Parameters:
Name | Type | Description |
---|---|---|
elem |
Element | The control to affect. |
offset |
number | The number of months to change by. |
- Source:
Example
$(selector).datepick('changeMonth', 2)
(inner) clear(elem)
Clear an input and close a popup datepicker.
Parameters:
Name | Type | Description |
---|---|---|
elem |
Element | The control to use. |
- Source:
Example
$(selector).datepick('clear')
(inner) day(date, day) → {Date}
Set the day for a date.
Parameters:
Name | Type | Description |
---|---|---|
date |
Date | The original date. |
day |
number | The new day of the month. |
- Source:
Returns:
The updated date.
- Type
- Date
Example
$.datepick.day(date, 25)
(inner) dayOfYear(year, monthopt, dayopt) → {number}
Calculate the day of the year for a date.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
year |
Date | number | The date to get the day-of-year for or the full year. | |
month |
number |
<optional> |
The month (1-12), if the year is a number. |
day |
number |
<optional> |
The day, if the year is a number. |
- Source:
Returns:
The day of the year.
- Type
- number
Example
var doy = $.datepick.dayOfYear(2014, 12, 25)
var doy = $.datepick.dayOfYear(new Date(2014, 12-1, 25))
(inner) daysInMonth(year, monthopt) → {number}
Find the number of days in a given month.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
year |
Date | number | The date to get days for or the full year. | |
month |
number |
<optional> |
The month (1 to 12), if the year is a number. |
- Source:
Returns:
The number of days in this month.
- Type
- number
Example
var days = $.datepick.daysInMonth(2014, 12)
var days = $.datepick.daysInMonth(new Date(2014, 12-1, 25))
(inner) determineDate(dateSpec, defaultDateopt, currentDateopt, dateFormatopt, settingsopt) → {Date}
A date may be specified as an exact value or a relative one.
Parameters:
Name | Type | Attributes | Description | ||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
dateSpec |
Date | number | string | The date as a Date ,
or as a string in the current dateFormat ,
or as a numeric offset - in days from today,
or as a string of amounts and periods, e.g. '+1m +2w',
using 'd' for days, 'w' for weeks, 'm' for months, and 'y' for years. |
|||||||||||||||||||||||||
defaultDate |
Date |
<optional> |
The date to use if no other supplied, may be null . |
||||||||||||||||||||||||
currentDate |
Date |
<optional> |
The current date as a possible basis for relative dates,
if null today is used. |
||||||||||||||||||||||||
dateFormat |
string |
<optional> |
The expected date format - see formatDate . |
||||||||||||||||||||||||
settings |
object |
<optional> |
With these properties:
Properties
|
- Source:
Returns:
The decoded date.
- Type
- Date
Example
var date = $.datepick.determineDate('+1m +2w', new Date())
(inner) disable(elem)
Disable the control.
Parameters:
Name | Type | Description |
---|---|---|
elem |
Element | The control to affect. |
- Source:
Example
$(selector).datepick('disable')
(inner) enable(elem)
Enable the control.
Parameters:
Name | Type | Description |
---|---|---|
elem |
Element | The control to affect. |
- Source:
Example
$(selector).datepick('enable')
(inner) formatDate(formatopt, date, settingsopt) → {string}
Format a date object into a string value.
The format can be combinations of the following:
- d - day of month (no leading zero)
- dd - day of month (two digit)
- o - day of year (no leading zeros)
- oo - day of year (three digit)
- D - day name short
- DD - day name long
- w - week of year (no leading zero)
- ww - week of year (two digit)
- m - month of year (no leading zero)
- mm - month of year (two digit)
- M - month name short
- MM - month name long
- yy - year (two digit)
- yyyy - year (four digit)
- @ - Unix timestamp (s since 01/01/1970)
- ! - Windows ticks (100ns since 01/01/0001)
- '...' - literal text
- '' - single quote
Parameters:
Name | Type | Attributes | Default | Description | ||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
format |
string |
<optional> |
defaultOptions.dateFormat | The desired format of the date. | ||||||||||||||||||||||||
date |
Date | The date value to format. | ||||||||||||||||||||||||||
settings |
object |
<optional> |
With these properties:
Properties
|
- Source:
Returns:
The date in the above format.
- Type
- string
Example
var display = $.datepick.formatDate('yyyy-mm-dd', new Date(2014, 12-1, 25))
(inner) getDate(elem) → {Array.<Date>}
Retrieve the selected date(s) for a datepicker.
Parameters:
Name | Type | Description |
---|---|---|
elem |
Element | The control to examine. |
- Source:
Returns:
The selected date(s).
- Type
- Array.<Date>
Example
var dates = $(selector).datepick('getDate')
(inner) hide(elem, immediateopt)
Hide a popup datepicker.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
elem |
Element | object | The control to use or the current instance settings. | ||
immediate |
boolean |
<optional> |
false | true to close immediately without animation (internal). |
- Source:
Example
$(selector).datepick('hide')
(inner) isDisabled(elem) → {boolean}
Is the first field in a jQuery collection disabled as a datepicker?
Parameters:
Name | Type | Description |
---|---|---|
elem |
Element | The control to examine. |
- Source:
Returns:
true
if disabled, false
if enabled.
- Type
- boolean
Example
if ($(selector).datepick('isDisabled')) {...}
(inner) iso8601Week(year, monthopt, dayopt) → {number}
Set as
calculateWeek
to determine the week of the year based on the ISO 8601 definition.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
year |
Date | number | The date to get the week for or the full year. | |
month |
number |
<optional> |
The month (1-12), if the year is a number. |
day |
number |
<optional> |
The day, if the year is a number. |
- Source:
Returns:
The number of the week within the year that contains this date.
- Type
- number
Example
var week = $.datepick.iso8601Week(2014, 12, 25)
var week = $.datepick.iso8601Week(new Date(2014, 12-1, 25))
(inner) month(date, month) → {Date}
Set the month for a date.
Parameters:
Name | Type | Description |
---|---|---|
date |
Date | The original date. |
month |
number | The new month (1-12). |
- Source:
Returns:
The updated date.
- Type
- Date
Example
$.datepick.month(date, 12)
(inner) multipleEvents(fns)
Apply multiple event functions.
Parameters:
Name | Type | Description |
---|---|---|
fns |
function | The functions to apply. |
- Source:
Example
onShow: $.datepick.multipleEvents(fn1, fn2, ...)
(inner) newDate(year, monthopt, dayopt) → {Date}
Return a new date.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
year |
Date | number | The date to clone or the year. | |
month |
number |
<optional> |
The month (1-12), if the year is a number. |
day |
number |
<optional> |
The day, if the year is a number. |
- Source:
Returns:
The date.
- Type
- Date
Example
$.datepick.newDate(oldDate)
$.datepick.newDate(2014, 12, 25)
(inner) parseDate(format, value, settingsopt) → {Date}
Parse a string value into a date object.
See
formatDate
for the possible formats, plus:
- * - ignore rest of string
Parameters:
Name | Type | Attributes | Description | ||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
format |
string | The expected format of the date ('' for default datepicker format). | |||||||||||||||||||||||||
value |
string | The date in the above format. | |||||||||||||||||||||||||
settings |
object |
<optional> |
With these properties:
Properties
|
- Source:
Throws:
Errors if the format and/or value are missing, if the value doesn't match the format,
or if the date is invalid.
Returns:
The extracted date value or
null
if value is blank.
- Type
- Date
Example
var date = $.datepick.parseDate('dd/mm/yyyy', '25/12/2014')
(inner) performAction(elem, action)
Perform a
named action
for a datepicker.
Parameters:
Name | Type | Description |
---|---|---|
elem |
element | The control to affect. |
action |
string | The name of the action. |
- Source:
Example
$(selector).datepick('performAction', 'prev')
(inner) retrieveDate(elem, target) → {Date}
Retrieve the date associated with an entry in the datepicker.
Parameters:
Name | Type | Description |
---|---|---|
elem |
Element | The control to examine. |
target |
Element | The selected datepicker element. |
- Source:
Returns:
The corresponding date, or
null
.
- Type
- Date
Example
var date = $(selector).datepick('retrieveDate', $('div.datepick-popup a:contains(10)')[0])
(inner) selectDate(elem, target)
Select a date for this datepicker.
Parameters:
Name | Type | Description |
---|---|---|
elem |
Element | The control to examine. |
target |
Element | The selected datepicker element. |
- Source:
Example
$(selector).datepick('selectDate', $('div.datepick-popup a:contains(10)')[0])
(inner) setDate(elem, dates, endDateopt, keyUpopt, setOptopt)
Set the selected date(s) for a datepicker.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
elem |
Element | The control to examine. | ||
dates |
Date | number | string | array | The selected date(s), as a Date ,
or as a string in the current dateFormat
or as a numeric offset - in days from today,
or as a string of amounts and periods, e.g. '+1m +2w',
using 'd' for days, 'w' for weeks, 'm' for months, and 'y' for years,
or as an array of these. |
||
endDate |
Date | number | string |
<optional> |
The ending date for a range. | |
keyUp |
boolean |
<optional> |
false | true if coming from keyUp processing (internal). |
setOpt |
boolean |
<optional> |
false | true if coming from option processing (internal). |
- Source:
Example
$(selector).datepick('setDate', new Date(2014, 12-1, 25))
$(selector).datepick('setDate', '12/25/2014', '01/01/2015')
$(selector).datepick('setDate', [date1, date2, date3])
(inner) show(elem)
Show a popup datepicker.
Parameters:
Name | Type | Description |
---|---|---|
elem |
Element | Event | The control to use or a focus event (internal). |
- Source:
Example
$(selector).datepick('show')
(inner) showMonth(elem, yearopt, monthopt, dayopt)
Set the currently shown month and day, defaulting to today.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
elem |
Element | The control to affect. | |
year |
number |
<optional> |
The year to show. |
month |
number |
<optional> |
The month to show (1-12). |
day |
number |
<optional> |
The day to show. |
- Source:
Example
$(selector).datepick('showMonth', 2014, 12, 25)
(inner) today() → {Date}
Return today's date.
- Source:
Returns:
Today.
- Type
- Date
Example
var today = $.datepick.today()
(inner) year(date, year) → {Date}
Set the year for a date.
Parameters:
Name | Type | Description |
---|---|---|
date |
Date | The original date. |
year |
number | The new year. |
- Source:
Returns:
The updated date.
- Type
- Date
Example
$.datepick.year(date, 2014)