I\'m building a date picker in jQuery ui. What I\'m trying to do is set a range, so when they pick the first date the second date appears and gives a 30 day window. I tried this
$("#start_date").datepicker().on('changeDate', function(selected){
startDate = new Date(selected.date.valueOf());
$('#end_date').datepicker('setStartDate', startDate);
});
$("#end_date").datepicker().on('changeDate', function(selected){
startDate = new Date(selected.date.valueOf());
$('#start_date').datepicker('setEndDate', startDate);
});