Code courtesy of @adrianfraguela! 🙂
##The following will generate calendar tokens for Google and Outlook. Based on Sanford's amazing Agical - https://blog.teknkl.com/introducing-agical-io-the-smarter-ics-file-generator/
##01 - Setting variables
#set($event_organizer = "Team")
#set($event_title = "NAME OF EVENT")
#set($event_timezone = "America/Los_Angeles") ##IMPORTANT! FOR THIS TO WORK MAKE SURE TO USE A CANONICAL https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
#set($event_start_date = "YYYY-MM-DD") ##YYYY-MM-DD
#set($event_start_time = "HH:MM") ##24 hour format
#set($event_end_date = "YYYY-MM-DD") ##YYYY-MM-DD
#set($event_end_time = "HH:MM") ##24 hour format
#set($event_reminder = "15") ##Reminder of the event that pops up in someone's calendar
#set($event_all_day = false) ##true/false - used for events that span multiple days
#set($event_lobby = "Event lobby with HTTPS://")
#set($event_description = "Thank you for registering for ${event_title}.")
#set($event_join = "To join this webinar please follow this link: ${event_lobby}")
##DO NOT EDIT BELOW THIS LINE
##Setting date and times correctly
#set($locale = $date.getLocale())
#set($timezone = $date.getTimeZone().getTimeZone("${event_timezone}"))
##Create date objects from the strings above for start and end times
#set($agical_start_date = $date.toDate("yyyy-MM-dd HH:mm", "${event_start_date} ${event_start_time}", $locale, $timezone)) ##Creates a date object from the string
#set($agical_end_date = $date.toDate("yyyy-MM-dd HH:mm", "${event_end_date} ${event_end_time}", $locale, $timezone)) ##Creates a date object from the string
##Format the date ready for AgiCal
#set($agical_start_date = $date.format("yyyy-MM-dd'T'HH:mm:ssZ", $agical_start_date, $locale, $timezone)) ##Formats the date into something readable for AgiCal
#set($agical_end_date = $date.format("yyyy-MM-dd'T'HH:mm:ssZ", $agical_end_date, $locale, $timezone)) ##Formats the date into something readable for AgiCal
##Escaping the evils
#set($event_title_gcal = $event_title.replace("+", "%2B"))
#set($event_title_gcal = $esc.url($event_title_gcal))
#set($agical_start_date = $esc.url($agical_start_date))
#set($agical_end_date = $esc.url($agical_end_date))
#set($event_organizer = $esc.url($event_organizer))
#set($event_title = $esc.url($event_title))
#set($event_description_gcal = $event_description.replace("+", "%2B"))
#set($event_description_gcal = $esc.url($event_description_gcal))
#set($event_description = $esc.url($event_description))
#set($event_lobby_gcal = $esc.url($event_lobby))
#set($event_reminder = $esc.url($event_reminder))
#set($event_join_outlook = $esc.url($event_join))
#set($event_join_gcal = $event_join.replaceAll("\n", "<BR>"))
#set($event_join_break = "<BR>")
##Produce the wonderful AgiCal URLs
#set($agical_url = "https://ics.agical.io/?subject=${event_title}&organizer=${event_organizer}&reminder=${event_reminder}&dtstart=${agical_start_date}&dtend=${agical_end_date}&attach=${event_lobby}&location=${event_lobby}&description=${event_description}${event_join_outlook}")
#set($agical_url_gcal = "https://ics.agical.io/?subject=${event_title_gcal}&organizer=${event_organizer}&reminder=${event_reminder}&dtstart=${agical_start_date}&dtend=${agical_end_date}&attach=${event_lobby_gcal}&location=${event_lobby_gcal}&description=${event_description_gcal}${event_join_break}${event_join_gcal}&format=gcal")
##All day and all night?
#if($event_all_day == true)
#set($agical_url = "$agical_url&allday=1")
#set($agical_url_gcal = "$agical_url&allday=1")
#end
##Output the links
<a href="${agical_url}" target="_blank" class="atc-outlook" style="color: #fe5000;">Outlook</a> | <a href="${agical_url_gcal}" target="_blank" class="atc-gcal" style="color: #fe5000;">Google Calendar</a>
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.