2

Is there any option for User to select only month, instead of date in Bootstrap datepicker. I am trying to do is allow users pick months and years only.

 $('.date').each(function() {
     var datepickerComponent = $(this).datepicker({
        language: 'en',
        format: "mm-yyyy",
        viewMode: "months", 
        minViewMode: "months"
      }).on('changeDate', function() {
        $(datepickerComponent).datepicker('hide');
      });
  });

I tried all option mentioned in this below link. But I didn't get expected behaviour.

Link to other question:

Bootstrap Datepicker - Months and Years Only

Please help me.

Community
  • 1
  • 1
Srini
  • 76
  • 7

1 Answers1

0

Bootstrap provides DateTimePicker also. It resolves my problem. We have lots of options in DateTimePicker. $(".form_datetime").datetimepicker({ format: 'MM-yyyy', autoclose: true, pickTime: false, viewMode: 'months', minViewMode: 'months' }); For more information please go through this link

Community
  • 1
  • 1
Srini
  • 76
  • 7