Magento 1.9 Date Picker with Only Month and Year

calendarformsmagento-1.9

At frontend i have to add Date-picker where have to show only Month and Year(not date) with year in range(like 1990 – 2020).

Please suggest me how can i do this?

Best Answer

I propose you this solution with Bootstrap Datepicker, Demo: JsFiddle

<!--Html part-->
    <div class="input-append date" id="datepicker" data-date="" data-date-format="mm-yyyy"> 
        <input  type="text" readonly="readonly" name="date" >     
        <span class="add-on"><i class="icon-th"></i></span>   
    </div>

<!--Js part-->
<script type="text/javascript">
    $("#datepicker").datepicker( {
    format: "mm-yyyy",
    viewMode: "months", 
    minViewMode: "months"
    });
</script>

More informations in : Bootstrap datepicker doc

Nb: don't forget to include this if you don't have theme:

  • bootstrap-combined.min.css

  • datepicker.css

  • bootstrap.min.js

  • bootstrap-datepicker.js

Related Topic