Validating the last date of a month
<p>I have two functions that calculate the last date of a month entered by a user </p>

<pre><code>var effectiveAsOfDateYear = document.forms[0].effectiveAsOfDateYear.value;   
var effectiveAsOfDateMonth = document.forms[0].effectiveAsOfDateMonth.value;          
var effectiveAsOfDateDay = document.forms[0].effectiveAsOfDateDay.value;                

userEnteredDate = effectiveAsOfDateDay; 

userEnteredMonth = effectiveAsOfDateMonth;

// **Then using if condition** 
if (!isLastDayOfMonth(userEnteredDate, userEnteredMonth))   {
alert("Inside isLastDayOfMonth of continueUploadReportAction ");
// Do something         
}
------------------------------------------------------------------
// The function is defined as below **strong text**          
function isLastDayOfMonth( date, month ) {
alert("Inside isLastDayOfMonth, the date is " + date );
alert("Inside isLastDayOfMonth, the month is " + month );
return ( date.toString() == new Date( date.getFullYear(), month, 0, 0, 0, 0, 0 ).toString() );
}
</code></pre>

<p>However at runtime when I select the month as 7 and date as 24, 
the actual values passed to the <code>isLastDayOfMonth</code> function are 
<code>alert("Inside isLastDayOfMonth, the date is " + date );</code> is 6 
and <code>alert("Inside isLastDayOfMonth, the month is " + month );</code> is 24
and return never seems to be correct.</p>

<p>Please suggest a better approach ..</p>
