// last month case "lastmo": // we need a new month variable for month-1, also formatted correctly var lastmonth = ((month - 1) < 10) ? "0" + (month - 1) : (month - 1); startbox.value = lastmonth + "/01/" + year; // now grab the last day of the month (30, 31? we don't know!) var moend = new Date(year, (month - 1), 0); endbox.value = lastmonth + "/" + moend.getDate() + "/" + year; break;
Disclaimer The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.