Bootstrap DateTimePicker: Using Month/Year reverts back to showing days after clicked initially

坚强是说给别人听的谎言 提交于 2019-12-25 14:11:45

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!