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

670
Vistas
FullCalender - How to automatically fetch and display previous events?

I am trying to display previous events in fullCalendar. But there's a problem: after you define an event and then refresh the page the events disappear.

Is there any way that I can fetch all the details from all the previous events and display them on the calendar?

This is my code:

document.addEventListener('DOMContentLoaded', function() {
    var calendarEl = document.getElementById('calendar');

    let calendar = new FullCalendar.Calendar(calendarEl, {
        timeZone: 'UTC',
        initialView: 'dayGridMonth',
        selectable: true,
        headerToolbar: {
            left: 'prev,next',
            center: 'title'
        },
        editable: true,
        eventClick: function(info) {
            info.jsEvent.preventDefault(); // don't let the browser navigate

            if (info.event.url) {
                window.open(info.event.url);
            }
        },
        dateClick: function(info) {
            endDate = info.dateStr;
            localStorage.enddate = info.dateStr;
            setTimeout(cal, 1000);

            function cal() {
                if (imgUrl !== ' ' && today <= endDate) {
                    calendar.addEvent({
                        title : `Post ${l++}`,
                        url   : `${imgUrl}`,
                        start : `${today}`,
                        end   : `${endDate}`
                    });

                    imgUrl = ' ';
                } else if (today > endDate) {
                    alert('Please select a date that is in the future!');
                } else {
                    return;
                }
            }

            var today = new Date();
            var dd = String(today.getDate()).padStart(2, '0');
            var mm = String(today.getMonth() + 1).padStart(2, '0'); //January is 0!
            var yyyy = today.getFullYear();
            today = yyyy + '-' + mm + '-' + dd;

            const date1 = new Date(`${today}`);
            const date2 = new Date(`${endDate}`);
            seconds = date2 - date1;
            console.log(seconds);
        }
    });

    calendar.render();
});
about 4 years ago · Juan Pablo Isaza
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