简体   繁体   中英

jquery FullCalendar custom recurring events

Im using FullCalendar jquery library for creating events. The requirement here is to create recurring events every x days. For example create an event that is recurring on each second Monday (every 14 days in this case).

Currently the library supports weekly or monthly recurring events. How can I achieve this?

I think @CBroe is correct, you could achive this using your own logic.

To add events to the calendar you must first populate an array of events, this can then be bound to the calendars events property.

For example:

 var events = getEvents();

$('#myCalendar').fullCalendar({
                    themeSystem: 'bootstrap3',
                    header: {
                        left: 'prev,next today',
                        center: 'title',
                        right: 'month,agendaWeek,agendaDay,listMonth'
                    },
                    weekNumbers: true,
                    weekends: false,
                    navLinks: true, // can click day/week names to navigate views
                    editable: true,
                    eventStartEditable: false,
                    height: 'auto',
                    eventLimit: true, // allow "more" link when too many events
                    events: events,
                    viewRender: function (view, element) {
                        events = getEvents();
                        $('#myCalendar').fullCalendar('removeEvents');
                        $('#myCalendar').fullCalendar('addEventSource', events);
                    },
                });

function getEvents(){
 var events = [];
 var arrayOfDates; //Populate dates at intervals of 14 days

  $.each(arrayOfDates, function () {
                    var date = this;
                        //Create event
                        events.push({
                            title: 'myEvent',
                            start: date,
                            end: date,
                            allDay: true,
                            color: '#228B22',
                            stick: true
                        });

                });
    }

   return events;
}

Well something like that anyway.. this should give you a good starting point

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM