Listing past events
dugiwarc opened this issue · comments
George Botnaru commented
Hello,
How would I go about listing past events from a calendar?
Best wishes,
George.
Kubessandra commented
Hello !
Here is the code to list Upcoming events
/**
* List all events in the calendar
* @param {number} maxResults to see
* @param {string} calendarId to see by default use the calendar attribute
* @returns {any}
*/
public listUpcomingEvents(maxResults: number, calendarId: string = this.calendar): any {
if (this.gapi) {
return this.gapi.client.calendar.events.list({
'calendarId': calendarId,
'timeMin': (new Date()).toISOString(),
'showDeleted': false,
'singleEvents': true,
'maxResults': maxResults,
'orderBy': 'startTime'
})
} else {
console.log("Error: this.gapi not loaded");
return false;
}
}
Actually timeMin
is taking the actual Time.
You can contribute to the project and create a PullRequest and pass timeMin as parameter to the function.
If you have any questions, I'm available.