Global

Type Definitions

DatepickCalculateWeek(date) → {number}

Calculate the week of the year for a date. Use it with the calculateWeek option.
Parameters:
Name Type Description
date Date The date to evaluate.
Source:
Returns:
The week of the year.
Type
number
Example
calculateWeek: function(date) {
  return Math.floor(($.datepick.dayOfYear(date) - 1) / 7) + 1;
}

DatepickCommandAction(inst)

Perform the action for a command.
Parameters:
Name Type Description
inst object The current instance settings.
Source:
Example
action: function(inst) {
  $.datepick.setDate(inst.elem, inst.curMinDate());
}

DatepickCommandDate(inst) → {Date}

Calculate the representative date for a command.
Parameters:
Name Type Description
inst object The current instance settings.
Source:
Returns:
A date appropriate for this command.
Type
Date
Example
date: function(inst) {
  return inst.curMinDate();
}

DatepickCommandEnabled(inst) → {boolean}

Determine whether a command is enabled.
Parameters:
Name Type Description
inst object The current instance settings.
Source:
Returns:
true if this command is enabled, false if not.
Type
boolean
Example
enabled: function(inst) {
  return !!inst.curMinDate();
}

DatepickMonthsOffset(date) → {number}

Determine where the first month shows in a multi-month calendar. Use it with the monthsOffset option.
Parameters:
Name Type Description
date Date The first date to be shown.
Source:
Returns:
The offset within the calendar for the first month - first position is 0.
Type
number
Example
monthsToShow: 3,
monthsToStep: 3,
monthsOffset: function(date) { // Always start on the quarter
  return date.getMonth() % 3;
}

DatepickOnChangeMonthYear(year, month)

React to navigating through the months/years. Use it with the onChangeMonthYear option.
Parameters:
Name Type Description
year number The new year.
month number The new month (1 to 12).
Source:
Example
onChangeMonthYear: function(year, month) {
  alert('Now in ' + month + '/' + year);
}

DatepickOnClose(dates)

Datepicker on close callback. Triggered when a popup calendar is closed. Use it with the onClose option.
Parameters:
Name Type Description
dates Array.<Date> The selected date(s).
Source:
Example
onClose: function(dates) {
  alert('Selected ' + dates);
}

DatepickOnDate(date) → {object}

Provide information about an individual date shown in the calendar. Use it with the onDate option.
Parameters:
Name Type Description
date Date The date to evaluate.
Properties:
Name Type Description
selectable boolean true if this date can be selected.
dateClass string Class(es) to be applied to the date.
content string The date cell content.
tooltip string A popup tooltip for the date.
Source:
Returns:
Information about that date, with the properties above.
Type
object
Example
onDate: function(date) {
  return {selectable: date.getDay() > 0 && date.getDay() &lt; 5,
    dateClass: date.getDay() == 4 ? 'last-day' : ''};
}

DatepickOnHover(date, selectable)

Callback when hovering over a date within the datepicker. Use it with the hoverCallback function.
Parameters:
Name Type Description
date Date The currently hovered date.
selectable boolean true if this date can be selected.
Source:
Example
$.datepick.hoverCallback(function(date, selectable) {
  $('#hoverOutput').text(
    (selectable ? $.datepick.formatDate(date) : null) || 'nothing');
})

DatepickOnSelect(dates)

Datepicker on select callback. Triggered when a date is selected. Use it with the onSelect option.
Parameters:
Name Type Description
dates Array.<Date> The selected date(s).
Source:
Example
onSelect: function(dates) {
  alert('Selected ' + dates);
}

DatepickOnShow(picker, inst)

Update the datepicker display. Use it with the onShow option.
Parameters:
Name Type Description
picker jQuery The datepicker div to be shown.
inst object The current instance settings.
Source:
Example
onShow: function(picker, inst) {
  picker.append('&lt;button type="button">Hi&lt;/button>').
    find('button:last').click(function() {
      alert('Hi!');
    });
}