dtarvin — 2010-12-31T14:29:38-05:00 — #1
Here is the code in question:
var theDate = new Date();
for (monthCounter = 0; monthCounter < 12; monthCounter++)
theMonth = theDate.toString();
theMonth = theMonth.substr(4, 3);
document.write("<option value=" + theMonth + ">" + theMonth);
Thank you in advance for the help.
mrhoo — 2010-12-31T16:07:15-05:00 — #2
Your new Date() is probably December 31-
if you change only the month to February you are getting February 31, which is resolved to March 3 (it would be March 2 in 2012).
Set the starting date to the 1rst of the month, instead of whatever todays date may be.
var theDate = new Date(2011,0,1); //january 1,2011
felgall — 2010-12-31T16:43:03-05:00 — #3
It would actually need to be either 29th or 30th to get that result.
31st would give:
Jan Mar Mar May May Jul Jul Aug Oct Oct Dec Dec
mrhoo — 2010-12-31T19:46:27-05:00 — #4