Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

521
Views
JS - FullCalendar : Listen when the month changes

I'm having a little issue with FullCalendar v5, I configured it with the dayGridMonth View and I would like to listen when the user changes the current month ...

For example, if he is seeing February and click on next he'll see march, so I was expected for a handler like onChange or onMonthChange but I didn't find anything in the documentation to do something like this ...

I figured how to get around the problem by making my own prev / next buttons and triggering my custom handler on the click ... But I would like to know if there is a vanilla way to do it?

Thanks for your answers.

about 4 years ago · Santiago Gelvez
1 answers
Answer question

0

As mentionned by @Devsi Odedra, the answer was datesSet

The doc : https://fullcalendar.io/docs/datesSet

This is my actual code if it can help someone :

new Calendar(document.getElementById("calendar"), {
    plugins: [ dayGridPlugin, interactionPlugin ],
    datesSet: event => {
        // As the calendar starts from prev month and end in next month I take the day between the range
        var midDate = new Date((event.start.getTime() + event.end.getTime()) / 2).getMonth()
        var month = `0${ midDate.getMonth() + 1 }`.splice(0, -1)
        doSomethingOnThisMonth(month, midDate.getFullYear())
    }
});

function doSomethingOnThisMonth(month, year) {
    fetch(`myApi.com/something?month=${ month }&year=${ year }`)
        .then((result) => {
            // Do something
        })
}
about 4 years ago · Santiago Gelvez Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!