There is an input:

<input type="text" name="filter" class="form-control" id="date"/> 

And js for him:

 $('#date').datetimepicker({ viewMode: "months", format: "M.YYYY", }); 

When you first click on the input script works fine: you can select the month and year. The second time you click on input (if the page has not been reloaded), the usual calendar with days, months and years falls out.

How to make it so that each time you click on input, the choice of month and year falls out?

  • Perhaps I will say nonsense, but the format is correctly recorded? is there not 2 M should be? - A1essandro
  • There are no problems with the format. The first time the calendar correctly fulfills. - Anatoly Ibragimov

1 answer 1

Solved a problem! It turns out that this bug is a bug of the latest versions of Bootstrap Datepicker (4.17.42 and 4.17.43). To work correctly, you need to download

  Bootstrap Datepicker Version 4.17.37 

It is also necessary to use

  JQuery version 2.1.4 
or lower since Datepicker version 4.17.37 cannot work with jQuery 3.0+