Saurav Dangol Saurav Dangol - 3 months ago 15
jQuery Question

Full calendar repeat events on weekly basis based in events

I want to repeat my events on weekly basis based on events being created. For example I have following events.

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
]
],


By adding dow:[1,4], the events are being repeated on Monday and Thursday,but the event is actually on Tuesday. My problem is that I want to display this event every Tuesday, but I am unable to find the day of week based on event. Is there a way to repeat event in such manner? Any help is really appreciated.

Answer

It can be done if you extact day of week from your start time and put that extracted day of week in a variable and place it in dow parameter of your json. It will be dynamic and more reliable. here is the modified code.

you can use calendar to extract day of week as:

INTEGER dayofweek;
 Calendar c = Calendar.getInstance();
 c.setTime(yourStartDate); // this IS your DATE which IS ON Tuesday 2016-01-26T02: 00: 00.000-07: 00
 dayofweek = c.get(Calendar.DAY_OF_WEEK);

now, put this variable IN your JSON AS follows:

 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: [dayofweek]
],
Comments