title: Date range picker on jquery ui datepicker
body: <p>I created a date range picker using jquery ui where you can use the same inline calendar to make both of your date selections.</p>
  
  <p>See my fiddle here: <a href="http://jsfiddle.net/kVsbq/4/">http://jsfiddle.net/kVsbq/4/</a></p>
  
  <p>JS</p>
  
  <pre><code>$(".datepicker").datepicker({
      minDate: 0,
      numberOfMonths: [12, 1],
      beforeShowDay: function (date) {
          var date1 = $.datepicker.parseDate($.datepicker._defaults.dateFormat, $("#input1").val());
          var date2 = $.datepicker.parseDate($.datepicker._defaults.dateFormat, $("#input2").val());
          return [true, date1 &amp;&amp; ((date.getTime() == date1.getTime()) || (date2 &amp;&amp; date &gt;= date1 &amp;&amp; date &lt;= date2)) ? "dp-highlight" : ""];
      },
      onSelect: function (dateText, inst) {
          var date1 = $.datepicker.parseDate($.datepicker._defaults.dateFormat, $("#input1").val());
          var date2 = $.datepicker.parseDate($.datepicker._defaults.dateFormat, $("#input2").val());
          if (!date1 || date2) {
              $("#input1").val(dateText);
              $("#input2").val("");
              $(this).datepicker();
          } else {
              $("#input2").val(dateText);
              $(this).datepicker();
          }
      }
  });
  </code></pre>
  
  <p>What I want to be able to do is a range selector like this: <a href="http://jsfiddle.net/D3wLX/1/">http://jsfiddle.net/D3wLX/1/</a> </p>
  
  <p>If you select an earlier date then the earlier date is automatically made the first date in the range and the middle dates are highlighted. Right now on my original jquery ui solution it will just put the earlier date in the second input and not highlight the dates in  between.</p>