Search code examples
jquerybootstrap-4bootstrap-datepicker

Bootstrap Datepicker next year button dissappears when showing only months and setting an endDate


I gave the Datepicker a StartDate and an EndDate but user can't go to last year that in the interval.

I configured the Bootstrap Datepicker for showing and selecting only year and month. Here is my code:

 $("#datepicker").datepicker({
                format: "mm/yyyy",
                startView: "months", 
                minViewMode: "months",
                multidate: true,
                multidateSeparator: ", ",
                startDate: new Date(2020, 0, 1),
                endDate: new Date(),
});

It works but when user clicks to see previous year, next year button dissappears as in below images.

First Initialization Previouse Month


Solution

  • After very detailed examination I noticed the problem occurs in "updateNavArrows" function in bootstrap-datepicker javascript file. Calculations for month view was wrong. I noticed that I am using older version of this file and when I upgraded it to a newer version, problem dissappeared.