title: How can I validate if a date occurs between two dates with Jquery?
body: <p>I want to check if a date occurs between two dates. 
  If this date occurs between these two dates the function should return true, otherwise it should return false.</p>
  
  <pre><code>&lt;script src="http://code.jquery.com/jquery-1.9.1.js"&gt;&lt;/script&gt;
  &lt;script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"&gt;&lt;/script&gt;
  
  &lt;script&gt;
      function dateCheck() {
          var fDate,lDate,cDate;
          fDate = jQuery.datepicker.formatDate('dd-mm-yy', new Date()); // firstdate
          cDate = jQuery.datepicker.parseDate('dd-mm-yy', 
          jQuery('#challenge_date').val()); // date from form
          lDate =  jQuery.datepicker.formatDate('dd-mm-yy', new Date());
          lDate.setDate(lDate.getDate() + 7); // lastdate
  
          if((cDate &lt;= lDate &amp;&amp; cDate &gt;= fDate)) {
              alert("true");
              return true;
          }
  
          alert("false");
          return false;
      }
  &lt;/script&gt;
  
  &lt;form action="#" method="post" onsubmit="return dateCheck()"&gt;
      &lt;input type="date" name="challenge_date" id="challenge_date"&gt;
      &lt;input type="submit" value="check"&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>Can anyone point out my mistake of give me a push in the right direction?</p>