validate date should be last date of month in javascript
<p>My requirement is to create a month which contains two date fields from date and to date</p>

<p>from date should be starting date of month and end date should be ending date of month..if from date is not starting date it should show message please select starting date of month same for to date also</p>

<p>i tried with this code </p>

<pre><code>function getDaysInMonth(aDate){

var m = new Number(aDate.getMonth());
var y = new Number(aDate.getYear());

var tmpDate = new Date(y, m, 28);
var checkMonth = tmpDate.getMonth();
var lastDay = 27;

while(lastDay &lt;= 31){
    temp = tmpDate.setDate(lastDay + 1);
    if(checkMonth != tmpDate.getMonth())
        break;
    lastDay++
}
return lastDay;
</code></pre>

<p>}</p>

<p>its not working pls help me</p>
