From f4e3c8d21eede2747db44d795f07ef7d44bfcc8f Mon Sep 17 00:00:00 2001 From: mikeyroy Date: Mon, 24 Feb 2014 14:48:03 -0800 Subject: [PATCH] Added a parameter, pastDatesSelectable, if false, dates prior to today will have the class datepickerDisabled added to their parent td --- js/datepicker.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/js/datepicker.js b/js/datepicker.js index aa03601..e89558d 100644 --- a/js/datepicker.js +++ b/js/datepicker.js @@ -192,7 +192,11 @@ * can also be 'click' for instance if the trigger element is a button * or some text element. */ - showOn: 'focus', + showOn: 'focus', + /** + * Whether or not to allow dates in the past to be selectable, boolean, defaults to true + */ + pastDatesSelectable: true, /** * Callback, invoked prior to the rendering of each date cell, which * allows control of the styling of the cell via the returned hash. @@ -346,6 +350,10 @@ if (date > today) { // current month, date in future data.weeks[indic].days[indic2].classname.push('datepickerFuture'); + } + + if (date < today && !options.pastDatesSelectable) { + data.weeks[indic].days[indic2].classname.push('datepickerDisabled'); } if (month != date.getMonth()) {