1

Wondering if anyone could shine some light on Fullcalendar v6.1.5

I'm trying to display the Fullcalendar to allow toggling up to +1 year from current year. Tried various methods even by trying to disable the fc-nextYear-button but, they don't even disable.

Also tried getFullYear and setFullYear though, unsuccessful.

ADyson
  • 57,178
  • 14
  • 51
  • 63
JustCode
  • 121
  • 9

1 Answers1

1

After hours of endless googling, I have the solution! In order to achieve this, I needed validRange and visibleRange with custom date specifications. With my case being unique of start = CURRENT YEAR and end = YEAR AFTER, Here's what I did.

var startOfYear = new Date(new Date().getFullYear(), 0, 1).toISOString().slice(0, 10);
  

var startOfNextYear = new Date(new Date().getFullYear() + 2, 0, 1).toISOString().slice(0, 10);

initialView: 'multiMonthYear',

    visibleRange: function() {
      return {
        start: startOfYear,
        end: startOfNextYear,
      };
    },
    validRange: function() {
      return {
        start: startOfYear,
        end: startOfNextYear,
      };
    },

Hopefully that helps someone. Spent HOURS looking for this.

JustCode
  • 121
  • 9