I'm trying to use the bootstrap datepicker from eternicode, which is a fork of the original eyecon picker.
I've added a jsfiddle example of what I'm trying to do.
At the bottom of all the js in the fiddle is where I initialize my datepicker.
I added a setTimout
so I could simulate changing the datepickers date dynamically.
I have read where you need to call datepicker('update');
after you do a setDate
so it updates the pickers UI.
When I do this it's causing some issues. If you click on the input field to show the calendar, the calendar will display showing the highlighted date as today's date not the new date I updated it with.
When you close the picker it will append todays date to the end of the input value. This is not normal behavior. All I'm trying to do is set a new date and have it update the UI picker at the same time.
HTML
<div class="input-append date" id="date-picker">
<input class="span6" size="16" type="text">
<span class="add-on"><i class=""></i></span>
</div>
var picker = $('#date-picker').datepicker({format:'M d, yyyy' });
var d = new Date();
d.setDate(d.getDate() + 1);
setTimeout(function(){
picker.datepicker("setDate", d).datepicker('update');
},3000);