diff --git a/css/datepicker/clean.css b/css/datepicker/clean.css index 6aea7bf..cd19fdc 100644 --- a/css/datepicker/clean.css +++ b/css/datepicker/clean.css @@ -50,7 +50,7 @@ tbody.datepickerDays td.datepickerSelected { } /* Grey out dates in the future */ -div.datepicker td.datepickerFuture a { +div.datepicker td.datepickerFuture a, div.datepicker td.datepickerMinDate a{ color:#DDDDDD; } diff --git a/js/datepicker.js b/js/datepicker.js index aa03601..da28b1b 100644 --- a/js/datepicker.js +++ b/js/datepicker.js @@ -169,6 +169,10 @@ * The day that starts the week, where 0: Sunday, 1: Monday, 2: Tuesday, 3: Wednesday, 4: Thursday, 5: Friday, 6: Saturday. Defaults to Sunday */ starts: 0, + /** + * Specify a minimum date + */ + minDate :null, /** * Previous link text. Default '◀' (Unicode left arrow) */ @@ -343,6 +347,11 @@ if (today.getDate() == date.getDate() && today.getMonth() == date.getMonth() && today.getYear() == date.getYear()) { data.weeks[indic].days[indic2].classname.push('datepickerToday'); } + + if (date < options.minDate) { + data.weeks[indic].days[indic2].classname.push('datepickerMinDate'); + } + if (date > today) { // current month, date in future data.weeks[indic].days[indic2].classname.push('datepickerFuture'); @@ -526,7 +535,7 @@ fillIt = true; } - } else if (parentEl.is('td') && !parentEl.hasClass('datepickerDisabled')) { + } else if (parentEl.is('td') && !parentEl.hasClass('datepickerDisabled') && !parentEl.hasClass('datepickerMinDate') ) { // clicking the calendar grid if(tblEl.eq(0).hasClass('datepickerViewMonths')) { @@ -1024,4 +1033,4 @@ return data ? fn( data ) : fn; }; -})(jQuery); +})(jQuery);