Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

535
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda