title: Bootstrap Datepicker: Ensuring EndDate > StartDate as well as having a max start date
body: <p>Apologies if my title is on the crappy side.  I should also start by mentioning that this is an MVC application if that matters.</p>
  
  <p>Here's what I'm trying to do.  I want my datepickers to have the following requirements:</p>
  
  <ul>
  <li>The start date must have a range of today - 45 days ago</li>
  <li>The end date must not be able to go past today</li>
  <li>The end date must come after the start date</li>
  </ul>
  
  <p>Here is what I've tried so far and have gotten the first 2 bullets working:</p>
  
  <p>HTML</p>
  
  <pre><code>&lt;div class="col-md-6 row"&gt;
      &lt;div class="form-group"&gt;
        &lt;label for="StartDate"&gt;Start Date&lt;/label&gt;
        &lt;input  type="text" id="StartDate" class="form-control" data-provide="datepicker" data-date-start-date="-45d" data-date-end-date="0d"&gt;
        &lt;label for="EndDate"&gt;End Date &lt;/label&gt;
        &lt;input  type="text" id="EndDate" class="form-control" data-provide="datepicker" data-date-start-date="-45d" data-date-end-date="0d"&gt;
        &lt;/div&gt;
    &lt;/div&gt;
  </code></pre>
  
  <p>Javascript:</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
  $(document).ready(function () {
    $("#StartDate").datepicker({
      dateFormat: 'mm/dd/yyyy',
      onSelect: function (selected) {
        $("#EndDate").datepicker("option", "minDate", selected)
      }
    });
    $("#EndDate").datepicker({
      dateFormat: 'mm/dd/yyyy',
      onSelect: function (selected) {
        $("#StartDate").datepicker("option", "maxDate", selected)
      }
    });
  </code></pre>
  
  <p>I've tried also removing some of the data attributes in the HTML and instead adding them to the datepicker methods in the javascript to no avail.</p>
  
  <p>I tried using the solutions to these following questions as well to no avail:</p>
  
  <ul>
  <li><a href="https://stackoverflow.com/questions/17169772/how-to-compare-two-datepicker-date-jquery">how to compare two datepicker date jquery</a></li>
  <li><a href="https://stackoverflow.com/questions/12652492/twitter-bootstrap-datepicker-how-to-enable-only-specific-daterange?lq=1">Twitter Bootstrap datepicker: how to enable only specific daterange</a></li>
  </ul>
  
  <p><strong>It also appears that most of the examples I've found use JQuery UI 1.9.2.  I only use JQuery 1.9.1 and NOT UI.  Does that make a difference?</strong></p>
  
  <p>I'm new to javascript and all this other web stuff so I'm sure I'm missing something very simple but any assistance is appreciated.</p>