I found various answers to add no. of days to a given date. But i want to add a number of days to a Date & Time which is in format MM-DD-YYYY HH:MM:SS
I tried this and this was successful when i had only date but with Date & time it returns invalid date when i console.log(startDate)
HTML
<input type="text" id="startBidding" name="startBidding" >
<input type="radio" name="expiry" value="5"> <span> 5 Days </span>
<input type="radio" name="expiry" value="10"> <span> 10 Days </span>
<input type="text" id="endBidding" name="endBidding" >
jQuery
$(document).ready(function() {
$('input[type=radio][name=expiry]').change(function() {
var days = this.value;
var startDate=new Date($("#startBidding").val());
startDate.setDate(startDate.getDate()+parseInt(days));
var inputDate = (startDate.getMonth()+1)+'-'+(startDate.getDate())+'-'+(startDate.getFullYear());
$("#endBidding").val(inputDate);
});
});