javascript date(leap year)
<p>i have this code where the user inputs the start date and then it will automatically add the end date. the end date is +3 days to the start date. the problem is after the month of february, march26-31 and so outputs wrong end date. it always output wrong end date from 26-31.  i think the problem is the leap year but i don't know how to fix it. please help me.</p>

<p>this is the code:</p>

<pre><code>&lt;input type="date" name="start_date" id="start" onKeyUp="date()"&gt;
&lt;input type="text" name="end_date" id = "end" onKeyUp="date()" disabled /&gt;
        &lt;script type = "text/javascript"&gt;
function date() {
var startdate = document.getElementById('start');
var enddate = document.getElementById('end');
//conver you selected stuff to a proper date format
var old = new Date(Date.parse(startdate.value));
//take a new date
var newdate=new Date(Date.parse(startdate.value)+24*60*60*1000*3);
// add how many days you want to add i use 3 you can use as many
newdate.setDate(old.getDate()+3);
enddate.value = (newdate.getMonth()+1)+'-'+newdate.getDate()+'-'+newdate.getFullYear(); 
}
&lt;/script&gt;
</code></pre>
