Bootstrap DatePicker setDate method not updating calendar

Andre Lombaard picture Andre Lombaard · Jul 28, 2014 · Viewed 28.3k times · Source

I'm setting the value of a bootstrap datepicker by making use of the setValue method provided.

For example

tripToDatePicker.setValue(tripFromDatePicker.date);

But for some reason the calendar is not updated

enter image description here

Answer

Ryu_hayabusa picture Ryu_hayabusa · Jul 30, 2014

Edit:

http://www.eyecon.ro/bootstrap-datepicker/ is not much documented, you should try http://eternicode.github.io/bootstrap-datepicker/.

anyway the code below will work for you

$("#dp1").datepicker("update", "02-16-2012");

or

$("#dp1").datepicker("setValue", "02-17-2012");

where "#dpi" is the id of the text field on whcih datepicker is used.