I\'m trying to fix this problem I\'m having. I have to input tags, one is for Training beginning date and other is for training ending date. What i am trying to do is create
Here you have the same question with Jquery UI Datepicker jQuery UI Picking a start and end date within range based on start date And a working example:
html
js
$(document).ready(function () {
$("#dt1").datepicker({
dateFormat: "dd-M-yy",
minDate: 0,
onSelect: function (date) {
var dt2 = $('#dt2');
var startDate = $(this).datepicker('getDate');
var minDate = $(this).datepicker('getDate');
dt2.datepicker('setDate', minDate);
startDate.setDate(startDate.getDate() + 30);
//sets dt2 maxDate to the last day of 30 days window
dt2.datepicker('option', 'maxDate', startDate);
dt2.datepicker('option', 'minDate', minDate);
$(this).datepicker('option', 'minDate', minDate);
}
});
$('#dt2').datepicker({
dateFormat: "dd-M-yy"
});
});
http://jsfiddle.net/PPSh3/7/
Hope that help