I am trying to add a certain number of days to currentDate
.
But the date returned is something weird. The same date if I am trying to subtract with number of days it works fine. Also if I am hardcoding the value instead of taking it from document.getElementById
it works fine.
P.S : document.getElementById
is returning proper value.
var someDateForFuture = new Date();
var numberOfDaysToCalculateForFuture = document.getElementById('futureDateCal').value;
someDateForFuture.setDate(someDateForFuture.getDate() + numberOfDaysToCalculateForFuture);
alert(someDateForFuture);
Now if I have added 3 to number of days of current date, the alert displays
Sat Apr 01 2017 11:23:57 GMT+0530 (India Standard Time)
Please guide.