Scriptcalendar.com
An Incredible Javascript Event Calendar

User Guide

»  Table Of Contents

Reoccuring Events

Section 3.4.2

Another use for the scspcevt.js is to code reoccuring events. For example, you could have an event that happens the 2nd Monday of every month. The following is an example of how to write such an event.

// 2nd Monday of every month
if (intWeekday==1 && intWeekOfMonth==2) {
    objEvent = new EventObj(m,d,y, "2nd Monday", null, "scEventRed");
    arrEvents[arrEvents.length] = objEvent;
};

The code relies on the variables with the scspcevt.js function that are based on the date being rendered.

Another example is an event that occurs on the 1st and 3rd Sunday of each month.

// first and third Sunday
if (intWeekday==0 && (intWeekOfMonth==1 || intWeekOfMonth==3) ) {
    objEvent = new EventObj(m,d,y, "1st & 3rd Sunday", null, "scEventRed");
    arrEvents[arrEvents.length] = objEvent;
};

»  Table Of Contents