Search code examples
jquerybootstrap-datetimepicker

Bootstrap datetimepicker next month can be selected only once


I have a Datetimepicker configured so that it shows only months. Also, user is able to select only future months. All works until I select next month (current month + 1) then another month. After these steps made I cannot select the next month anymore.

enter image description here

Is it a bug in Datetimepicker itself or I'm doing something wrong?
Here is the demo


Solution

  • It seems like a bug with bootstrap's datetimepicker when you allow only months but the minDate is not the first day of your month.
    You can fix this by using:

    minDate = new Date(new Date().getFullYear(), new Date().getMonth() + 1, 1, 0, 0, 0, 0);
    

    Here is a working example:
    https://jsfiddle.net/24L6rysx/