问题
I'm using Bootstrap.v3.Datetimepicker v4.17.43 in MVC 4.5 project. I set it up as follows:
$(function() {
var decDate = new Date(new Date().getFullYear(), 11, 31);
$("#MyDatePicker")
.datetimepicker({
viewMode: 'years',
format: 'MM/YYYY',
defaultDate: decDate
});
});
This initially works as expected, showing only the years. However when clicking a second time, it reverts to show days. I uninstalled all my jquery and bootstrap and reinstalled it from scratch making sure I got the latest stable versions (using Nuget Install) (jquery v3.1.1, bootstrap v3.3.7, bootstrap-datetimepicker v4.17.43). Is there anything I'm missing here?
来源:https://stackoverflow.com/questions/40510314/bootstrap-datetimepicker-using-month-year-reverts-back-to-showing-days-after-cl