D
dhtmlkitchen
I'll try a more explicit approach.Hi All.
I'm having a problem adding days to a date.
My date is in the string format dd/mm/yyyy eg. 23/08/2007 in my
form field.
I can't work out how to add 50 days to that date and then write it to
another form field.
The first step is to add 50 days to the date object.
// get the date.
var date = new Date();
var dayOfMonth = date.getDate()); // This API method "getDate" should
be renamed to "getDayOfMonth".
// add 50 days.
date.setDate( dayOfMonth + 50 );
Write a unit test to verify each step.Any help would be appreciated.
Here is a horrible ad hoc test:
javascript:alert(new Date (new Date().setDate( new Date().getDate() +
50 ) - ( 50 * 24 * 60 * 60 * 1000 ) ) )
Garrett