NDK
06-30-2009, 09:28 AM
I have a weird problem with adding days to a date.
To add days i use: newEnddate.setDate(newEnddate.getDate()+extra);
When i use a fix number it works fine.
(var extra = 35)
But if i ask the user how many days he want to add to a date, the new date isn't correct.
(var extra = prompt("How many days?","10");
in the prompt i change 10 to 35
Here are the results:
If i use fix number to add (example 35)
old date: 2009/7/12
new date : 2009/8/16
the is correcy
But if i use a prompt and ask there a number (again 35)
old date: 2009/7/12
new date: 2012/11/17
If i print the var extra, for both i get 35...
How is this possible :confused:
To add days i use: newEnddate.setDate(newEnddate.getDate()+extra);
When i use a fix number it works fine.
(var extra = 35)
But if i ask the user how many days he want to add to a date, the new date isn't correct.
(var extra = prompt("How many days?","10");
in the prompt i change 10 to 35
Here are the results:
If i use fix number to add (example 35)
old date: 2009/7/12
new date : 2009/8/16
the is correcy
But if i use a prompt and ask there a number (again 35)
old date: 2009/7/12
new date: 2012/11/17
If i print the var extra, for both i get 35...
How is this possible :confused: