In trying to extract a day agenda from Google Calendars as part of a workflow process administered using Google Apps Script I call getEventsForDay() from the CalendarApp service.
A specific (simplified) example:
var calendarView = CalendarApp.getCalendarById(ScriptProperties.getProperty("calendarID"));
var today = new Date();
var todaysEvents = calendarView.getEventsForDay(today);
This populates the array todaysEvents with all the days events fine, but also includes recurring events prior to and post where the recurrence spans the date in the query but does not occur on the day itself. (query Wed, recurring event on Mon, Tue, Fri will be returned)
We run our calendars to GMT/BST so I have looked into whether this is a function of Date() returning dates as PDT and not UTC, but on occasion events that are over 24 hours in either direction are returned.
Assuming this is not a bug, I can't work out a good way of filtering out these 'invalid' events from the returned array. Can you?
Or is this a bug?
Thanks