1month = Number($("#con_months_of_contract").val());
2
3var date = $('#datepicker2').val();
4var newdate = date.split("-").reverse().join("-");
5var myDate = new Date(newdate);
6// select month one change
7var newDate2 = new Date(myDate.setMonth(myDate.getMonth()+month));
8//renewal date is -1
9newDate2.setDate(newDate2.getDate()-1);
10$("#datepicker4").datepicker("setDate", newDate2);
11
12//@sujay