Skip to content

Instantly share code, notes, and snippets.

@kutyel
Last active November 2, 2022 09:25
Show Gist options
  • Save kutyel/07b2866ee7144bbba92cc6cad2e8d18d to your computer and use it in GitHub Desktop.
Save kutyel/07b2866ee7144bbba92cc6cad2e8d18d to your computer and use it in GitHub Desktop.
const app = Application.currentApplication()
app.includeStandardAdditions = true
let Calendar = Application("Calendar")
const rounds = [
["Round 1", "12/26/2022 17:00"],
["Round 2", "12/27/2022 10:00"],
["Round 3", "12/27/2022 17:00"],
["Round 4", "12/28/2022 10:00"],
["Round 5", "12/28/2022 17:00"],
["Round 6", "12/29/2022 10:00"],
["Round 7", "12/29/2022 17:00"],
["Round 8", "12/30/2022 09:30"],
["Round 9", "12/30/2022 16:30"]
]
const [cal] = Calendar.calendars.whose({name: "Home"})
for (const [summary, dateStr] of rounds) {
const startDate = new Date(dateStr)
const aux = new Date(dateStr)
const endDate = new Date(aux.setHours(aux.getHours() + 3))
const event = Calendar.Event({ summary, startDate, endDate })
cal.events.push(event)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment