Bootstrap datetimepicker only month and year not working as intended

前端 未结 1 584
别跟我提以往
别跟我提以往 2021-01-14 17:21

My Datetime picker works on the fist click, but if I click again in the input field again it shows the picker with the day field. How can I do this? Any help will be appreci

相关标签:
1条回答
  • 2021-01-14 18:20

    Try as follow

    $('#dpRM').datetimepicker({
        viewMode : 'months',
        format : 'MM/YYYY',
        toolbarPlacement: "top",
        allowInputToggle: true,
        icons: {
            time: 'fa fa-time',
            date: 'fa fa-calendar',
            up: 'fa fa-chevron-up',
            down: 'fa fa-chevron-down',
            previous: 'fa fa-chevron-left',
            next: 'fa fa-chevron-right',
            today: 'fa fa-screenshot',
            clear: 'fa fa-trash',
            close: 'fa fa-remove'
        }
    });
    
    $("#dpRM").on("dp.show", function(e) {
       $(e.target).data("DateTimePicker").viewMode("months"); 
    });
    

    REF :: GitHub

    0 讨论(0)
提交回复
热议问题