js for validation date range
<p>anyone can help me....how to validate javascript date for this problem:</p>

<p>user select the start date and end date will be chosen to be more than 90 day from the start date.user can send form if end date below 90day...</p>

<pre><code>from date code :
&lt;input name="fromDate" type="text" id="fromDate" size="10" maxlength="10" onChange=""&gt;
&lt;a href="#" name="anchorFrmDate" id="anchorFrmDate" onClick="calFrmDate.select(document.forms[0].fromDate,anchorFrmDate,'dd/MM/yyyy'); return false;"&gt;DATE&lt;/a&gt;

to date code:
&lt;input name="Todate" type="text" id="Todate" size="10" maxlength="10" onChange=""&gt;
a href="#" onClick="calToDte.select(document.forms[0].Todate,'anchorToDte','dd/MM/yyyy'); return false;" name="'anchorToDte'" id="'anchorToDte'"&gt;&lt;strong&gt;DATE&lt;/strong&gt;&lt;/a&gt;
</code></pre>

<hr>

<p>I've tried and my code below ... but do not succeed ... which part that i make Mistake</p>

<pre><code>function checkDateRange(fromDate, Todate) { 
   // Parse the entries 
   var startDate = Date.parse(fromDate); 
   var endDate = Date.parse(Todate); 
   // Make sure they are valid 
    if (isNaN(startDate)) { 
      alert("The start date provided is not valid, please enter a valid date."); 
      return false; 
   } 
   if (isNaN(endDate)) { 
       alert("The end date provided is not valid, please enter a valid date."); 
       return false; 
   } 
   // Check the date range, 86400000 is the number of milliseconds in one day 
   var difference = (endDate - startDate) / (7776000000); 
   if (difference &lt; 0) { 
       alert("The start date must come before the end date."); 
       return false; 
   } 
   if (difference &lt;= 1) { 
       alert("The range must be at least seven days apart."); 
       return false; 
    } 
   return true; 
}
</code></pre>
