How to set a default date in Bootstrap Datepicker?
I want to set a date : 24/12/2006
When I open datepicker it should show me this date select on calender.
If you want to make the change global, look for the following in bootstrap-datepicker.js:
function UTCToday(){
var today = new Date();
return UTCDate(today.getFullYear(), today.getMonth(), today.getDate());
and hard code in your date, for example:
function UTCToday(){
var today = new Date();
return UTCDate(2006, 00, 01);
Which will open on 1 January 2006. Note that for some reason January is '00' rather than '01'.
you can simply assign a value (with you to your input tag and it should work
<input type="text" class="form-control" value="22-05-2017">
In my version, if you put the val in the input, the calendar is updated automatically.
$('#birthdate').val("01/01/2001");