title: How to dynamically set bootstrap-datepicker's date value?
body: <p>I am using bootstrap datepicker along with a line highchart.</p>
  
  <p>I want the datepicker date to update when the chart is zoomed. Once that event triggers I update the values of the datepicker. The values update fine but when the calendar is clicked, the date on the popup calendar is still the old date.</p>
  
  <p>Here is my datepicker:</p>
  
  <pre><code>&lt;div class="input-append date pull-right" id="dpStartDate" data-date="@DateTime.Now.AddMonths(-1).ToString("dd/MM/yyyy")" data-date-format="dd/mm/yyyy"&gt;
      &lt;input class="span2" id="startDateText" size="16" type="text" value="@DateTime.Now.AddMonths(-1).ToString("dd/MM/yyyy")" readonly=""&gt;
      &lt;span class="add-on"&gt;&lt;i class="icon-th"&gt;&lt;/i&gt;&lt;/span&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>I have tried just updating the values using this code:</p>
  
  <pre><code>$('#dpStartDate').attr('data-date', startDate);
  $('#startDateText').attr('value', startDate);
  </code></pre>
  
  <p>which updates the dates fine but doesn't set the calendar.</p>
  
  <p>I've also tried triggering the onChange event, which also updates the dates but not the calendar:</p>
  
  <pre><code>$('#dpStartDate').trigger('changeDate', startDate);
  
  $('#dpStartDate').datepicker()
      .on('show', function (ev) {
          ev.stopPropagation();
      })
      .on('changeDate', function (ev, date) {
          var startDate = new Date();
          if (date != undefined) {
              startDate = date;
              $('#dpStartDate').attr('data-date', startDate);
              $('#startDateText').attr('value', startDate);
          }
          else {
              startDate = ev.date;
              $('#dpStartDate').attr(startDate.getDate() + '/' + (startDate.getMonth() + 1) + '/' + startDate.getFullYear());
              $('#startDateText').attr(startDate.getDate() + '/' + (startDate.getMonth() + 1) + '/' + startDate.getFullYear());
          }
          $('#dpStartDate').datepicker('hide');
          ev.stopPropagation();
      });
  </code></pre>
  
  <p>Does anyone know if it's even possible to update the calendar like that?</p>
  
  <p>Thanks</p>