Page 328, step 7 does not work for February during leap year. If you substitute
var numDays = 0;
numDays = daysInMonth(month, dateObject.getFullYear());
for step 7, then add the following function to your JavaScript, you will correct that problem. (The comments are only for explanation purposes.)
// ********************************************************
// the code specified for getting days of month on pg 328
// is flawed. It does not take into account whether the year
// is leap year which changes the number of days in Feb
// daysInMonth function takes care of days in leap and non-leap years
// this snippet came from http://snippets.dzone.com/posts/show/2099
function daysInMonth(iMonth, iYear)
{
return 32 - new Date(iYear, iMonth, 32).getDate();
}
// now that's an amazing function!