Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bootstrap DatePicker setDate method not updating calendar

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

like image 269
Andre Lombaard Avatar asked Jul 28 '14 11:07

Andre Lombaard


People also ask

How do I change the default date format in bootstrap datepicker?

Go to line 1399 and find format: 'mm/dd/yyyy' . Now you can change the date format here.

How do I know if my datepicker is loaded?

You can check to see if the datepicker script has loaded using: if ($. fn. datepicker) { // ... }

What is Autoclose in datepicker?

autoclose. Whether or not to close the datepicker immediately when a date is selected.


1 Answers

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.

like image 90
Ryu_hayabusa Avatar answered Sep 20 '22 18:09

Ryu_hayabusa