date - JavaScript Dateobject Increment goes wrong -


i want increment year-value of given date, goes wrong.

this code:

var enddate = entry.start; enddate.setdate(enddate.getfullyear() + 5); 

and comparison output (console.log) is:

date {thu jun 30 2011 11:30:10 gmt+0200}

date {tue dec 06 2016 11:30:10 gmt+0100}

as can see, incremented month , day. missing? in advance

you have set year only, using setyear method:

enddate.setyear(enddate.getfullyear() + 5); 

using setdate(getfullyear()+5) add 5 + (year of date) days date value of enddate


Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -