Like System Events there is no UI in Date Events (except the temporary date panel).
It quits automatically after 5 minutes of inactivity.
To choose a date is pretty simple
set theDate to choose date
which shows a graphical interface with date and time.
You can set the style to textual and textual with stepper and there are
a few options for the date and time appearance.
Additionally there are some APIs to convert date to string and vice versa for
custom string format/template and locale, and also some calendar APIs to
get the start of the day or to check if a date is in yesterday, today or tomorrow.
You can add multiple calendars for example the iso8601 calendar and other international calendar types.
See the sample script in the zip archive – or have a look at the dictionary – for the available APIs.
System Requirements:
macOS 10.15 (and higher) Intel or Apple Silicon.
The app is written in Swift – the panel is presented by SwiftUI – it’s sandboxed and notarized.
tell application "Date Events"
set macIntroductionDate to date "24/1/1984"
set date of date picker to macIntroductionDate
set macDate to choose date
end tell
I figured it out. But there is a bug.
If I do this it works…
set mydate to (current date) + 4 * days
tell application "Date Events"
set quit delay to 120
tell date picker
set style to graphical -- textual ot textual with stepper
set time elements to hour minute second
set date elements to year month day -- not available in graphical style
end tell
set date of date picker to mydate
set theDate to choose date
end tell
but if I put the set date command inside the tell block like so…
set mydate to (current date) + 4 * days
tell application "Date Events"
set quit delay to 120
tell date picker
set style to graphical -- textual ot textual with stepper
set time elements to hour minute second
set date elements to year month day -- not available in graphical style
set date to mydate
end tell
set theDate to choose date
end tell