I have a form, where I need to do some validations by getting the current date and next date separately using javaScript.
I tried this code but it does not work correctly.
var currentDate = new Date();//get current date
var validdate=currentDate;
validdate.setDate(validdate.getDate()+1);
But what happens is when valid date changes to +1, then current date also changes to +1.
But I need it separately, means when I print the output: I get
currentDate = 5th May 2014;
validdate = 6th May 2014;
Then when again I print currentDate
, it changes to "6th May 2014".
How to get the current date and next date without affecting each other?