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

336
Vistas
Display all past data and hide all future data in javascript fullcalendar

As you can see in this javascript fullcalendar code, I want to display all past data in title and hide all future data in fullcalendar title.. the future data will show on its date. I'm beginner can you help me that how to hide future data in title. Thanks.

        var calendar = new FullCalendar.Calendar( calendarEl, {
         headerToolbar: {
               left:   'title',
               center: '',
               right:  'prev,next'
            },
             initialDate: '2022-04-01',
            dayMaxEvents: true, 
            events: [
                
                {
                    title: '8',
                    start: '2022-04-13',
                },
                {
                    title: '9',
                    start: '2022-04-14',
                },
                {
                    title: '6',
                    start: '2022-04-15',
                },
                {
                    title: '4',
                    start: '2022-04-18',
                },
                {
                    title: '6',
                    start: '2022-04-19',
                },
                    {
                    title: '3',
                    start: '2022-04-20',
                },
                {
                    title: '3',
                    start: '2022-04-21',
                },
                {
                    title: '3',
                    start: '2022-04-22',
                },
                {
                    title: '3',
                    start: '2022-04-25',
                },
                {
                    title: '3',
                    start: '2022-04-26',
                },
                {
                    title: '3',
                    start: '2022-04-27',
                }
            
    
                
            ]
        });
about 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

Use Array.prototype.filter to filter events starting after now.

var calendar = new FullCalendar.Calendar(calendarEl, {
    headerToolbar: {
        left: 'title',
        center: '',
        right: 'prev,next'
    },
    initialDate: '2022-04-01',
    dayMaxEvents: true,
    events: [
        {
            title: '8',
            start: '2022-04-13',
        },
        {
            title: '9',
            start: '2022-04-14',
        },
        {
            title: '6',
            start: '2022-04-15',
        },
        {
            title: '4',
            start: '2022-04-18',
        },
        {
            title: '6',
            start: '2022-04-19',
        },
        {
            title: '3',
            start: '2022-04-20',
        },
        {
            title: '3',
            start: '2022-04-21',
        },
        {
            title: '3',
            start: '2022-04-22',
        },
        {
            title: '3',
            start: '2022-04-25',
        },
        {
            title: '3',
            start: '2022-04-26',
        },
        {
            title: '3',
            start: '2022-04-27',
        }
    ].filter(event => new Date(event.start).getTime() < Date.now())
});

You can also refactor this operation into a function like so:

function filterFutureEvents(events) {
   return events.filter(event => new Date(event.start).getTime() < Date.now());
}

// usage
const fileteredEvents = filterFutureEvents([/* ... */]);
about 4 years ago · Santiago Trujillo 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