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.
I wanted to set a date at the startup, and the mentionned methods didn't work. The date was shown, but when I clicked on the object the date was not selected.
So what I did is retrieving the Datepicker object of the library, and apply the _setDate method on it :
$('#dob').data("datepicker")._setDate(date);
But for this to work, the date object must be at midnight on UTC time, so before I did :
var date = new Date();
date.setUTCHours(0,0,0,0);
And then it worked.