Bootstrap Datepicker - Months and Years Only

后端 未结 8 1529
逝去的感伤
逝去的感伤 2020-12-02 07:07

I am using bootstrap datepicker and my code is like following, Demo of the code on jsfiddle

相关标签:
8条回答
  • 2020-12-02 08:09

    You should have to add only minViewMode: "months" in your datepicker function.

    0 讨论(0)
  • 2020-12-02 08:11

    How about this :

    $("#datepicker").datepicker( {
        format: "mm-yyyy",
        viewMode: "months", 
        minViewMode: "months"
    });
    

    Reference : Datepicker for Bootstrap


    For version 1.2.0 and newer, viewMode has changed to startView, so use:

    $("#datepicker").datepicker( {
        format: "mm-yyyy",
        startView: "months", 
        minViewMode: "months"
    });
    

    Also see the documentation.

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