Bootstrap Datepicker re-initialize date format

date, datepicker, javascript, jquery, twitter-bootstrap-3

Solution

Ok I resolve this extending bootstra-datepicker.js

setFormat: function(format) {
    this.format = DPGlobal.parseFormat(format);
}

And call that function

find('#options-date_format').on('change', function(){
    $("#picker").datepicker('setFormat', newFormat);
});

Problem

I have Bootstrap datepicker with default format mm/dd/yyyy, and I have select where I can change format from mm/dd/yyyy to dd/mm/yyyy and reverse. On select change I want to my datepicker change format. I tried ``` find('#options-date_format').on('change', function(){ $("#picker").datepicker({format: formatDate}) }); ``` but It's not working, and I can't find way of doing this. Also tried to remove / destroy datepicker but I got javascript error.

Original source