Bootstrap-datepicker: setStartDate resetting calendar completely

Created on 1 Mar 2017  路  8Comments  路  Source: uxsolutions/bootstrap-datepicker

Expected behaviour

Calendar should keep set options

Actual behaviour

Calendar is resetting to a naked calendar
might be similar to #1180

Datepicker version used

ex. 1.7dev

Example code

select a start date, then try to select end date.
https://jsfiddle.net/hewhy2mm/18/

is-bug

All 8 comments

I'm labeling this as a bug (this can be reproduced) but it's not specific to 1.7 as this also occurs in 1.6.4. See http://jsfiddle.net/zcvq0yhh/188/

So there is no workaround?

It's also doing it on update

https://jsfiddle.net/hewhy2mm/19/

Is there an update on this? PITA for users

any update on this?

Anything?

Didn't see a reference to this in 1.8.0 update. assuming it's not fixed?

Found a work around. It's not ideal but it works.

$('#date_from').on('change', function() {
$('#date_to').removeData();
$('#date_to').datepicker({
autoclose: true,
todayBtn: true,
disableTouchKeyboard: true,
todayHighlight: true,
clearBtn: true,
daysOfWeekHighlighted: "0,6",
startDate: $('#date_from').val()
});
});

Essentially just remove all data from the date_to element and then create a new datepicker.

Was this page helpful?
0 / 5 - 0 ratings