Type Definitions
CalendarsDigits(value) → {string}
Convert a number into a localised form.
Parameters:
Name | Type | Description |
---|---|---|
value |
number | The number to convert. |
- Source:
Returns:
The localised number.
- Type
- string
Example
digits: $.calendars.substituteDigits(['۰', '۱', '۲', '۳', '۴', '۵', '۶', '۷', '۸', '۹'])
CalendarsPickerCalculateWeek(date) → {number}
Calculate the week of the year for a date.
Parameters:
Name | Type | Description |
---|---|---|
date |
CDate | The date to evaluate. |
- Source:
Returns:
The week of the year.
- Type
- number
Example
calculateWeek: function(date) {
var startYear = date.newDate(date.year(), 1, 1);
return Math.floor((date.dayOfYear() - startYear.dayOfYear()) / 7) + 1;
}
CalendarsPickerCommandAction(inst)
Perform the action for a command.
Parameters:
Name | Type | Description |
---|---|---|
inst |
object | The current instance settings. |
- Source:
Example
date: function(inst) {
$.datepick.setDate(inst.elem, inst.curMinDate());
}
CalendarsPickerCommandDate(inst) → {CDate}
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
- CDate
Example
date: function(inst) {
return inst.curMinDate();
}
CalendarsPickerCommandEnabled(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();
}
CalendarsPickerOnChangeMonthYear(year, month)
React to navigating through the months/years.
Parameters:
Name | Type | Description |
---|---|---|
year |
number | The new year. |
month |
number | The new month (calendar minimum month to maximum month). |
- Source:
Example
onChangeMonthYear: function(year, month) {
alert('Now in ' + month + '/' + year);
}
CalendarsPickerOnClose(dates)
Datepicker on close callback.
Triggered when a popup calendar is closed.
Parameters:
Name | Type | Description |
---|---|---|
dates |
Array.<CDate> | The selected date(s). |
- Source:
Example
onClose: function(dates) {
alert('Selected ' + dates);
}
CalendarsPickerOnDate(date) → {object}
Provide information about an individual date shown in the calendar.
Parameters:
Name | Type | Description |
---|---|---|
date |
CDate | 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.day() > 0 && date.day() < 5,
dateClass: date.day() === 4 ? 'last-day' : ''};
}
CalendarsPickerOnHover(date, selectable)
A function to call when a date is hovered.
Parameters:
Name | Type | Description |
---|---|---|
date |
CDate | The date being hovered or null on exit. |
selectable |
boolean | true if this date is selectable, false if not. |
- Source:
Example
function showHovered(date, selectable) {
$('#feedback').text('You are viewing ' + (date ? date.formatDate() : 'nothing'));
}
CalendarsPickerOnSelect(dates)
Datepicker on select callback.
Triggered when a date is selected.
Parameters:
Name | Type | Description |
---|---|---|
dates |
Array.<CDate> | The selected date(s). |
- Source:
Example
onSelect: function(dates) {
alert('Selected ' + dates);
}
CalendarsPickerOnShow(picker, inst)
Update the datepicker display.
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('<button type="button">Hi</button>').
find('button:last').click(function() {
alert('Hi!');
});
}