gok11
asked on
Add days to a date
I need to add a specific number of days to a date in JQuery. The set Date function is not computing the date correctly.
The number of days (advdays) to add is 45 or 90 or 120 .
var advDate = new Date();
var advdays = $(cntlName).val();
advDate.setDate( advDate.getDate() + advdays) ;
The computed advDate is never correct.
This needs to be jQuery since this is a part of a larger validation function.
Thank you for the help in advance.
The number of days (advdays) to add is 45 or 90 or 120 .
var advDate = new Date();
var advdays = $(cntlName).val();
advDate.setDate( advDate.getDate() + advdays) ;
The computed advDate is never correct.
This needs to be jQuery since this is a part of a larger validation function.
Thank you for the help in advance.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I've requested that this question be closed as follows:
Accepted answer: 0 points for gok11's comment #a40116952
for the following reason:
Reply from the expert made me realize that the value must be converted to Int before using it.
Accepted answer: 0 points for gok11's comment #a40116952
for the following reason:
Reply from the expert made me realize that the value must be converted to Int before using it.
ASKER
Using parseInt($(cntlName).val()