Saurav Dangol
Saurav Dangol

Reputation: 904

Displaying events based on dates in fullcalendar

I have events which are recurring weekly but the recurring events are displaying before current week as well. Can the recurring events be rendered only from current week and beyond? Currently Im using the following code to display my recurring week but it is not working.

My recurring event is as

events: [
id: 1,
title: Hello,
start: 2016-01-26T02: 00: 00.000-07: 00,
end: 2016-01-26T05: 30: 00.000-07: 00,
allDay: false,
eventType: availability,
rendering: background,
color: black,
dow: [1,4]

],

And My code to attempt my criteria is

eventRender: function(event, element) {
             return (event.start>=moment().startOf('week'));
            }

Upvotes: 1

Views: 154

Answers (1)

Saswat Raj Pandey
Saswat Raj Pandey

Reputation: 75

I think you should use moment property,this should help:

eventRender: function(event, element) {
if(((moment(event.eventDate))>($('#calendar').fullCalendar('getDate').endOf('week'))) {
element.hide();
}       
 }

Upvotes: 1

Related Questions