Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions js/datepicker.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,12 @@
* parseable by Date.parse(). Defaults to todays date.
*/
current: null,
/**
* Optional date range which limits the selectable dates. The range of acceptable dates,
* in an array of [min, max], disables any date outside of the range. Arguments should be
* Date objects.
*/
selectableDates: null,
/**
* true causes the datepicker calendar to be appended to the DatePicker
* element and rendered, false binds the DatePicker to an event on the trigger element
Expand Down Expand Up @@ -333,11 +339,15 @@
if (today.getDate() == date.getDate() && today.getMonth() == date.getMonth() && today.getYear() == date.getYear()) {
data.weeks[indic].days[indic2].classname.push('datepickerToday');
}
if (date > today) {
if($.isArray(options.selectableDates) && options.selectableDates.length == 2) {
if(date < options.selectableDates[0] || date > options.selectableDates[1]) {
data.weeks[indic].days[indic2].classname.push('datepickerFuture');
data.weeks[indic].days[indic2].classname.push('datepickerDisabled');
}
} else if (date > today) {
// current month, date in future
data.weeks[indic].days[indic2].classname.push('datepickerFuture');
}

if (month != date.getMonth()) {
data.weeks[indic].days[indic2].classname.push('datepickerNotInMonth');
// disable clicking of the 'not in month' cells
Expand Down Expand Up @@ -1012,4 +1022,4 @@
// Provide some basic currying to the user
return data ? fn( data ) : fn;
};
})();
})();