How to select multiple month in JQuery multipleDatePicker

1.5k views Asked by At

I am new to programming and just wanted to know how to select multiple months using jQuery multipleDatesPicker. Just Month and Year.

Source code.

$(function() {
   $('.date-picker').multiDatesPicker( {
      changeMonth: true,
      changeYear: true,
      showButtonPanel: true,
      dateFormat: "yy-mm",
      onClose: function(dateText, inst) { 
         var month = $("#ui-datepicker-div .ui-datepicker-month :selected").val();
         var year = $("#ui-datepicker-div .ui-datepicker-year :selected").val();
         debugger;
         $(this).multiDatesPicker('setDate', new Date(year,month,1));
     }
   });
});

CSS:

.ui-datepicker-calendar {
  display: none;
}
1

There are 1 answers

0
v.coder On

There are two things you can do to display only Month and Year in the calender:

<style>
.ui-datepicker-calendar {
    display: none;
}
</style>

and

$('.date-picker').multidatespicker( {
    changeMonth: true,
    changeYear: true,
    showButtonPanel: true,
    dateFormat: 'MM yy',
    onClose: function(dateText, inst) { 
        $(this).multidatespicker('setDate', new Date(inst.selectedYear, inst.selectedMonth, 1));
    }
});