Hi all, I’m trying to create a Shortcut that will look at my calendar and provide open 30 min time slots to put in an email to schedule a meeting time. The process I’m using is:
- Ask for a date
- Get all the events on that date
- Cycle through 30 min time slots, only keeping those without a calendar conflict
- Export that as a rich text to the clipboard to include in an email
The problem I have is feeding the provided input date into “Find Calendar Events” gets me nothing, even if something is on the calendar. I tried using “Format Date” to remove the time in the provided input. Still nothing. What am I doing wrong?
In case anyone has similar problems, the Date always includes a time even if it’s been stripped off by format date and time set to None. In order to get all the events on a particular day, I needed to search for all dates between the start of the day in question and the start of the next day. This is probably simple to most, but just in case it helps someone else I’ll leave this here. Thanks.
Just to add some context, that is because formatting changes how something is displayed and not its value. It’s like someone having different clothes. They look a bit different, you may be able to see more or less of them as a result (e.g., business wear vs tropical holiday paradise outfit), but underneath they are the same person.
As @sylumer noted, dates always have a time associated with them, just not always visible due to formatting. The formatting of the date can lead to a different way to manage your date issue; you can format the date that the user enters to add the times without needing the calculations by adding fixed times in the formatting of the dates in the Find Calendar Events action.
Sample Date Shortcut
This example formats the start date with the time 00:00:00 and the end date with the time 23:59:59. You could modify these to only include office hours for example rather than the whole day. This eliminates the need to do the calculations to get the date for the day after.
Hope this helps.
Edit: Meant to reply to the thread, not @sylumer directly, sorry.
Thanks for the help, @sylumer and @Tony. This is the first Shortcut I’m writing and it’s not like I other scripting languages I tried in the past. Even simple things like writing a new value to a variable (i = i + 1) isn’t straightforward. ¯_(ツ)_/¯
That formatting trick was very helpful, @sylumer. Thanks so much.
I’m making progress with my first shortcut. Is it just me or is this a very buggy interface. I can’t drag a block from the right side and put it in the flow properly. It seems to want to insert nowhere near where my finger is. Similarly, when trying to delete rules in the Get Calendar Dates block, I cannot press the delete button (except by using the pencil). Again, it thinks I’m pressing somewhere else other than under my finger.