1

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?

1 Answer 1

2

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

5
  • Prince i have one more problem, please can you look into this magento.stackexchange.com/questions/180915/… Thank you Commented Jun 29, 2017 at 9:12
  • You're welcome, if it's ok, you can accept the answer
    – PЯINCƎ
    Commented Jun 29, 2017 at 9:12
  • Prince please can you help me on magento.stackexchange.com/questions/180915/… Commented Jun 29, 2017 at 9:24
  • I'll take a look in a moment
    – PЯINCƎ
    Commented Jun 29, 2017 at 9:25
  • @Prince How can i do, the customer chooses the date on PDP page. It is necessary field customer need to choose which date your products want to deliver. How can i add the calendar on PDP Page?
    – Gem
    Commented Aug 6, 2018 at 7:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.