title: Default date range for jQuery-UI's datepicker
body: <p>I am using jQuery-UI to create a date range field. What I am trying to do is have my StartDate default to today's date minus seven days and have my EndDate default to "today's" date. Still allowing the dates to be changed if the user wants to change the dates. As well as not allowing the user to select a date in the future (After today's date). Is this all possible with jQuery-UI's datepicker?</p>
  
  <pre><code>&lt;script&gt;
    $( function() {
      var dateFormat = "mm/dd/yy",
        from = $( "#StartDate" )
          .datepicker({
            defaultDate: "+1w",
            changeMonth: true,
            numberOfMonths: 1
          })
          .on( "change", function() {
            to.datepicker( "option", "minDate", getDate( this ) );
          }),
        to = $( "#EndDate" ).datepicker({
          defaultDate: "+1w",
          changeMonth: true,
          numberOfMonths: 1
        })
        .on( "change", function() {
          from.datepicker( "option", "maxDate", getDate( this ) );
        });
  
      function getDate( element ) {
        var date;
        try {
          date = $.datepicker.parseDate( dateFormat, element.value );
        } catch( error ) {
          date = null;
        }
  
        return date;
      }
    } );
    &lt;/script&gt;
  
  &lt;span class="srch_title" for="StartDate"&gt;From&lt;/span&gt;
  &lt;input type='text' name="StartDate" id="StartDate" value="" required/&gt;
  
  &lt;span class="srch_title" for="EndDate"&gt;To&lt;/span&gt;
  &lt;input type='text' name="EndDate" id="EndDate" value="" required/&gt;
  </code></pre>
  
  <p><a href="https://jsfiddle.net/bobrierton/fdLy2n12/" rel="nofollow noreferrer">https://jsfiddle.net/bobrierton/fdLy2n12/</a></p>
  
  <p>Any help would be greatly appreciated!</p>