Calendar objects are used to manipulate and create calendars in the built-in Calendars app and its associated accounts.
Example
Event Creation
letcalendar = Calendar.findOrCreate("Activities"); letevent = calendar.createEvent(); event.title = "Dinner Party"; event.notes = "Bring side dish."; event.startDate = Date.parse("7pm next friday"); event.endDate = Date.parse("10pm next friday"); event.isAllDay = false; if (!event.update()) { console.log(event.lastError); }
Reading Calendar Events
// load a calendar letcal = Calendar.find("Test"); // loop over events in the last 30 days and alert the name of each. if (cal) { letevents = cal.events((30).days().ago(), newDate()); for (leteventofevents) { alert(event.title); } }
Searches for a calendar matching the title. If none is found, creates a new list with that title in your default calendars account. If more than one calendar with the same name exist in Calendars, the first found will be returned.
Calendar objects are used to manipulate and create calendars in the built-in Calendars app and its associated accounts.
Example
Event Creation
Reading Calendar Events