I am using the Jquery Datepicker found here.
Does anyone know how I can modify this code to allow for past date selecting.
$('#start-date').bind('dpClosed', function(e, selectedDates) {
var d = selectedDates[0];
if (d) {
d = new Date(d);
$('#end-date').dpSetStartDate(d.addDays(1).asString()).dpSetSelected(d.asString()).val($(this).val());
}
});
Adding a
$('.date-picker').dpSetStartDate('01/01/2000');
doesn’t work. 🙁
I would greatly appreciate all help.
Thanks,
Tim
If you simply want dates in the past to be selectable it is as simple as:
(see http://www.kelvinluck.com/assets/jquery/datePicker/v2/demo/datePickerPastDate.html )
Note that the startDate you pass in must me in the same format as you have set
Date.formatto (or dd/mm/yyyy by default).You can also dynamically allow e.g. dates in the last year like so: