javascript - Fullcalendar Repeating Events -
i using fullcalendar, , want repeat event once in month (on monday) form august november. have been able repeat event , event repeats 4 times in month on each monday of week -while need repeat once on first monday after start date . below date ranges passed along dow (days of week ) paramater.
var repeatingevents = [{ title:"my repeating event", id: 1, start: '10:00', end: '14:00', dow: [ 1, 4 ], ranges: [{ //repeating events displayed if within @ least 1 of following ranges. start: moment().startof('week'), //next 2 weeks end: moment().endof('week').add(7,'d'), },{ start: moment('2015-02-01','yyyy-mm-dd'), //all of february end: moment('2015-02-01','yyyy-mm-dd').endof('month'), },/*...other ranges*/], },/*...other repeating events*/];
is there way can repeat once in month , running form start date end date? assistance appreciated
if can't generate events on server side @adyson suggested, in javascript. finds first monday of month, between specified start , end dates.
var id=0, event, events = [], start=moment('2017-08-01'), end=moment('2017-10-31'); while (start.isbefore(end)) { id++; if (start.day() === 'monday') { day = start.format('yyyy-mm-dd'); } else { day = start.add(1, 'weeks').startof('isoweek').format('yyyy-mm-dd'); } event = { title:"my repeating event", id: id, start: day + ' 10:00:00', end: day + ' 14:00:00', } events.push(event); start.add(1, 'month').startof('month'); }
and use constructed array of events in calendar:
$('#calendar').fullcalendar({ events: events, // ...
Comments
Post a Comment