Bootstrap-Datepicker not selecting date when using "setDate"
<p>I'm trying to get Bootstarp-Datepicker to work and I've got it pretty close. However, now that I've found how to set the startDate and have been able to get "autoclose" to work I can't get it to select the date that is set in the "setDate"</p>

<p>If I bring up the calendar and then manual select another date that will show as selected but the setDate value doesn't show that date as selected. I've done a lot of searching but can't seem to find the right combination to work. </p>

<p>BTW: looking in the F12 tools I do have an error but it says "failed to load resource: the server responded with a 404 (not found)" and the source points to the "/fonts/glyphicons-halflings-regular" file. I don't think that has anything to do with it but I'm going to post a separate question for that. </p>

<p>Here is my HTML</p>

<pre><code>&lt;div class="col-md-2 text-left"&gt;
    &lt;div id="StartDate" class="input-group date"&gt;
        &lt;input class="datepicker form-control" type="text" /&gt;
        &lt;span class="input-group-addon"&gt;&lt;i class="glyphicon glyphicon-th"&gt;&lt;/i&gt;&lt;/span&gt;
    &lt;/div&gt;
&lt;/div&gt;
&lt;div class="col-md-2"&gt;
    &lt;div id="EndDate" class="input-group date"&gt;
        &lt;input type="text" class="form-control"&gt;
        &lt;div class="input-group-addon"&gt;
            &lt;span class="glyphicon glyphicon-th"&gt;&lt;/span&gt;
        &lt;/div&gt;
    &lt;/div&gt;
&lt;/div&gt;
</code></pre>

<p>Here is my JS. This JS will set the date and make autoclose work but it doesn't select the date set with the setDate method.</p>

<pre><code>&lt;script type="text/javascript"&gt;
    $(function () {
        var startDate = new Date();
        startDate.setDate(startDate.getDate() - 7);
        var endDate = new Date();

        $("#StartDate").datepicker({
            autoclose: true
        }).datepicker("update", startDate);

        $("#EndDate").datepicker({
            autoclose: true
        }).datepicker("update", endDate);
    });
&lt;/script&gt;
</code></pre>

<p>If I switch to this JS code I can get the setDate to work as well as get the date that was set to be selected. However, this causes the autoclose to not work. </p>

<pre><code>&lt;script type="text/javascript"&gt;
    $(function () {
        var startDate = new Date();
        startDate.setDate(startDate.getDate() - 7);
        var endDate = new Date();

        $("#StartDate").datepicker("setDate", startDate);
        $("#StartDate").datepicker("autoclose", true);
        $("#StartDate").datepicker("update");
    });
&lt;/script&gt;
</code></pre>