I try to select 2 month only ie. when i select date 1-06-2016 then to date must be 31-07-2016 means what ever user select date two months time period will be display how i do this
in this code currently only 1 month is display ie. if i select from date 1-06-2016 then to date shows 30-06-2016 but i want to select 2 months
<script type="text/javascript">
$(function () {
var currentYear = (new Date).getFullYear();
var currentMonth = (new Date).getMonth();
var currentDay = (new Date).getDate();
$('#fromdate').datepicker({
minDate: new Date((currentYear - 2), 12, 1),
//minDate: 0,
dateFormat: 'yy-mm-dd',
maxDate: new Date(currentYear, currentMonth, currentDay),
//maxDate: new Date((currentYear + 1), 12, 1),
onSelect: function (selectedDate) {
// Start Date
var startDate = $(this).datepicker('getDate');
$('#todate').datepicker('option', 'minDate', startDate);
$('#todate').datepicker('setDate', startDate);
// End Date
var enddate = $(this).datepicker('getDate');
enddate.setDate(enddate.getDate() + 30);
$('#todate').datepicker('option', 'maxDate', enddate);
}
});
$('#todate').datepicker({
minDate: new Date((currentYear - 2), 12, 1),
minDate: 0,
dateFormat: 'yy-mm-dd',
maxDate: '+30'
});
});
</script>