Hi,
I've this snippet:
var d1 = parseInt( document.getElementById('day1').value );
var m1 = parseInt( document.getElementById('month1').value );
var y1 = parseInt( document.getElementById('year1').value );
var dt = new Date();
dt.setYear(y1);
dt.setMonth(m1);
dt.setDate(d1 + 1);
document.getElementById('day2').value = dt.getDate();
document.getElementById('month2').value = dt.getMonth();
document.getElementById('year2').value = dt.getYear();
My goal is, to automatically init value of date2 by adding 1 day from date1. However, when I fill :
day1 = 32
month1 = 1
year1 = 2009
I got :
day1 = 5
month1 = 2
year1 = 2009
I don't know what is going on. Do you guys know the solutions?