title: Date Validation in javascript?
body: <p>i have problem with date validation in javascript </p>
  
  <p>the problem is i have popup calendar the return a date value 
  i want to check the date in javascript before send it to parent page </p>
  
  <p>in popup calendar.aspx</p>
  
  <pre><code>function passDateValue(DateValue)
  {
      window.returnValue=DateValue;
      window.close();
      return false;
  }
  </code></pre>
  
  <p>in popup calendar codebehind </p>
  
  <pre><code>ClientScript.RegisterStartupScript(GetType(), "SelectDate", "passDateValue('" + clrPopUp.SelectedDate.ToShortDateString() + "')", true);
  </code></pre>
  
  <p>the function that call the popup calendar and check the returned value </p>
  
  <pre><code>function Calendar_popup(tbClientID)
  {  
     var today = new Date();
  
     var Day = today.getDate();
  
     var Month = today.getMonth()+1;
  
     var Year = today.getFullYear();
  
     if(Month&lt;10){Month = '0'+Month;}
  
     if(Day&lt;10){Day = '0'+Day;}
  
     var todayFormat = Day + "/" + Month + "/" + Year;
  
     datevalue = window.showModalDialog("Calendar_Dialog.aspx?ctlid=" +       tbClientID, '',"dialogHeight:250px;dialogWidth:300px;");
  
     var startdate = Date.parse(datevalue);
  
     var enddate = Date.parse(todayFormat);
  
     if (startdate&gt;enddate)
     {alert('BirthDate Must be less than today');
     return;
     }
  }
  </code></pre>
  
  <p>is there anyway to check date ? </p>
  
  <p>thanks!</p>