title: Create dependent datepickers using bootstrap-datepicker
body: <p>I need to create two date pickers using the datepicker by <a href="https://github.com/uxsolutions/bootstrap-datepicker" rel="nofollow noreferrer">https://github.com/uxsolutions/bootstrap-datepicker</a> so that date selected in the first datepicker will be used as start date of second. The dates before the date picker of first one disabled in the second.</p>
  
  <p>The HTML for first date-picker:</p>
  
  <pre><code> &lt;div class="col-sm-6 row-margin" id="div-last-day"&gt;
   &lt;div class="input-group date"&gt;
   &lt;input type="text" class="test-width form-control input-xs" name="last-day-worked" id="last-day" placeholder="Select your last Date" readonly&gt;&lt;span class="input-group-addon input-xs"&gt;&lt;i class="glyphicon glyphicon-calendar"&gt;&lt;/i&gt;&lt;/span&gt;
  </code></pre>
  
  <p>
  </p>
  
  <p>Second date-picker:</p>
  
  <pre><code>  &lt;div class="col-sm-6 row-margin" id="div-separation-day"&gt;
       &lt;div class="input-group date"&gt;
        &lt;input type="text" class="test-width form-control input-xs" name="separation-day-worked" id="separation-day" placeholder="Select your Separation Date" readonly&gt;&lt;span class="input-group-addon input-xs"&gt;&lt;i class="glyphicon glyphicon-calendar"&gt;&lt;/i&gt;&lt;/span&gt;
   &lt;/div&gt;
    &lt;/div&gt;
  </code></pre>
  
  <p>Here is some of my code:</p>
  
  <pre><code>$("#div-last-day .input-group.date").datepicker({
              format: "dd-M-yyyy",
              todayHighlight: true,
              autoclose: true,
          });
          $('#div-last-day .input-group.date').datepicker()
          .on('changeDate', function (e) {
              var lastdate = $('#div-last-day .input-group.date').datepicker('getDate');
              var date = new Date(lastdate);
              var curr_date = date.getDate();
              var curr_month = date.getMonth();
              var curr_year = date.getFullYear();
              perfect_date = curr_date + "-" + m_names[curr_month]
              + "-" + curr_year;
              $("#div-separation-day .input-group.date").datepicker({
                  format: "dd-M-yyyy",
                  todayHighlight: true,
                  startDate: perfect_date,
                  autoclose: true,
              });
          });
  </code></pre>
  
  <p>Here is the fiddle I am working on <a href="https://jsfiddle.net/5tpn12L8/" rel="nofollow noreferrer">https://jsfiddle.net/5tpn12L8/</a></p>
  
  <p>The fiddle works for the first time but when I change the date in the first date-picker it doesn't update the second date-picker.</p>