Recurring events

ChrisRM edited this page Mar 22, 2012 · 1 revision

Add recurring events to your calendar.

Example

// As recurring events only works when using eventkit 
// as our datasource, make sure its set.
Ti.Calendar.dataSource("eventkit");
 
// For this event, we want it to repeat every other day in one month.
// Start by creating the end date for our recurrence rule.
var recurringEnd = new Date();
recurringEnd.setMonth(recurringEnd.getMonth()+1);
 
// Let's make the event last for 3 hours.
var eventEnd = new Date();
eventEnd.setHours(eventEnd.getHours()+3);
 
// Create and add the event to the calendar.
Ti.Calendar.addEvent({
    title: "Once every other day in one month",
    startDate: new Date(),
    endDate: eventEnd,
    location: "Appcelerator's HQ",
    note: "A note...",
    recurrence: { 
        frequency: "day", // day, week, month, year
        interval: 2, // 1 = every day, 2 = every other day, 3 = every third day and so on...
        end: recurringEnd 
    }
});

This is for EventKit only.