title: Date comparison in Jquery
body: <p>I want to compare the selected date and current date. Iam using jquery date picker. While using the following code only the date field comparison is takes place... How can i compare with month and year also... Advance thanks..</p>
  
  <pre><code>$(document).ready(function() {
  
  
  
          var objDate = new Date();
          var selectedDate = document.getElementById("&lt;%=txtRqstDate.ClientID %&gt;").value;
  
          var currentDate = $.datepicker.formatDate('dd/mm/yy', new Date());
          if (Date.parse(selectedDate) &gt; Date.parse(currentDate )) {
              alert("Invalid date range!\n Please choose a date that is not later than today!")
              return false;
          }
          else {
              return true;
          }
  </code></pre>