title: Bootstrap datepicker - two datepickers updating each others start/end dates
body: <p>I'm using the bootstrap-datepicker widget from <a href="https://github.com/eternicode/bootstrap-datepicker" rel="nofollow">eternicode</a>.</p>
  
  <p>I want two date pickers on my page, each updating the other;  </p>
  
  <ul>
  <li>Changing date1 should set the start date of date2.  </li>
  <li>Changing date2 should set the end date of date1.   </li>
  <li>Both dates should initially show today's date.</li>
  </ul>
  
  <p>Here's what I have so far</p>
  
  <pre><code>var month = ("January February March April May June July August September October November December").split(" ");
  var now = new Date();
  var nowformatted = now.getDate() + " " + month[now.getMonth()] + " " + now.getFullYear();
  var dpOptions = {
      format: 'dd MM yyyy',
      startDate: now,
      setDate: now,
  };
  var datePicker1 = $("#date1").
      val(nowformatted).
      datepicker(dpOptions).
      on('changeDate', function (e) {
              datePicker2.datepicker('setStartDate', e.date);
              datePicker2.datepicker('update');
      });
  
  var datePicker2 = $("#date2").
      val(nowformatted).
      datepicker(dpOptions).
      on('changeDate', function (e) {
              datePicker1.datepicker('setEndDate', e.date);
              datePicker1.datepicker('update');
      });
  </code></pre>
  
  <p>but it's causing chrome and FF to crash if date1 is changed BEFORE date2.  If date2 is changed first then the code works as intended.</p>
  
  <p>I could use some input on whether this is a bug in the plugin or in the way I've coded my implementation.</p>
  
  <p>Here's a <a href="http://jsfiddle.net/vG6qF/1/" rel="nofollow">fiddle</a> that doesn't actually crash the browser but it does hang for a second on selecting the first date.</p>
  
  <p>I should mention that I'm using bootstrap 3.  This plugin was intended for v2. Is this the problem? </p>
  
  <p>[update] I tried a <a href="http://jsfiddle.net/vG6qF/2/" rel="nofollow">fiddle</a> with bootstrap 2.3.2 - same hang on date1 selection so I'm guessing it's not the bootstrap version.</p>