Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

530
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda