🗓️ Calendar Agenda and API Demos

by Fran T

Version 28 (April 20, 2024)

Download (233 downloads)

Displays your agenda for your choice of calendars and range of dates.

Despite the ease of use of the Automate Calendar blocks, there are inconsistencies in Google's internal API that result in it being very tricky to get your events correctly. All-day events cause special difficulty, which we delve into in this Forum thread:

https://groups.google.com/forum/m/#!topic/automate-user/JfGZl5gLoFY

Some things to watch out for:

o All-day events that start on the following day are returned within the window of the current day and must be filtered out, first converting their beginning and ending times to the GMT (UTC) time zone
o All-day events that start on the current day are not found, requiring the GMT offset be subtracted from the midnight time in order to be detected
o All-day anniversary events are defined having both starting and ending times of midnight on the same date
o The beginning and ending times in the Has Event block are both inclusive and have one-second resolution, so the number of seconds in a day since midnight *minus one* (86399) must be used for the ending date to return results only for the current day
o Care must be taken not to inappropriately filter out multiday events or single events which span dates

In light of all these issues, I originally wrote this flow as a demo to figure out the best way to resolve them in my flows. It's written so that the critical logic is contained in a subroutine to make it easier to copy into your own flows. The subroutine returns the past, upcoming, and ongoing event counts, the starting and ending times of the agenda, and the agenda itself, which is a dictionary that maps the midnight time of each day to an array of the day's events from all of the selected calendars. To set up the subroutine, give it a variable called 'calendars', which is a dictionary of calendar URI keys mapped to calendar names. You can create that dictionary using the "Calendar Picker" subroutine, which also demonstrates how to do a content query to get calendar information. The Date Pick blocks also contain a workaround for having the date correctly default to today.

--------------
Updates:
o Work around another framework bug where all-day events are not detected for the current day; improve support for events which span days; allow multiple calendars to be chosen; rewrite user experience to be a standalone app
o Show repeating non-all-day events having the same title on the same day; improve all-day event deduplication; improve support for non-all-day events which span days; sort displayed events
o Add UI to change the date window after viewing the agenda; fix for window spanning DST
o Make dialog text more compact; preselect calendars and date
o Add event description/notes; linkify agenda dialog text
o Strikethrough text for today's past events
o Small fix for events at DST end

5.0 average rating from 2 reviews

5 stars
2
4 stars
0
3 stars
0
2 stars
0
1 star
0
Reports
0

Rate and review within the app in the Community section.