datepicker - set minDate of second datepicker on selection changed on date picker 1
Hi,
I have two date pickers, when the first date picker has its value changed, I want the minDate variable on the second date picker to be updated to be datepicker1 + 1 day.
My code isn't working since I added the minDate line, can someone point out where I went wrong?
- $("#arrivaldate").datepicker({
- showOn: 'button',
- buttonImage: 'images/calendar.gif',
- dateFormat: 'dd M yy',
- numberOfMonths: 3,
- minDate: 0,
- onSelect: function(dateStr) {
- var newDate = $(this).datepicker('getDate');
- if (newDate) { // Not null
- newDate.setDate(newDate.getDate() + 1);
- }
- $('#departuredate').datepicker('setDate', newDate);
- $('#departuredate').datepicker('minDate', newDate);
- },
- constrainInput: true,
- buttonImageOnly: true
- });