It was suggested on one of the sites I visited to add “my” in front of “date” (for the life of me I can’t remember why) to overcome my Calendar date problem (see below).
My script now works but I don’t know why.
– Works
tell application “Calendar”
set theDateStr to “10/01/26”
set theDate to my date (theDateStr)
return result
end tell
– Fails
– error “Calendar got an error: Can’t get date "10/01/26".” number -1728 from date “Thursday, October 1, 2026 at 12:00:00 AM”
tell application “Calendar”
set theDateStr to “10/01/26”
set theDate to date (theDateStr)
return result
end tell
Calendar.app has its own class date which cannot be used in the same way as date in Scripting Additions.
The application tell block prioritizes the application terminology, but the keyword my tells the compiler to talk to date of AppleScript itself (the date class in Scripting Additions).
Just delete the application tell block, it’s pointless in this case
set theDateStr to "10/01/26"
return date (theDateStr)
It’s a good habit to put only those lines into an application tell block which talk to the application.
This avoids the kind of unexpected behavior you’ve run into.