Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How Do I Create An iCal (.ics) File Programmatically?

Tags:

Within a client-side JS application, I would like for users to be able to export an event on my site to their Apple iCalender. How do I construct that file so that they can download it?

like image 643
Derek Dowling Avatar asked Sep 26 '18 16:09

Derek Dowling


People also ask

What is the difference between ICS and iCal?

ICalendar Format Although the iCalendar name is similar to that of Apple's iCal, the format is an open standard. Files using the iCalendar format may have a file extension of “. ics” for full calendar files or “. icb” for availability information only.


1 Answers

Apple iCalender can import .ics (RFC 5545) extension files. The best site I've seen documenting how to represent the necessary metadata within one of these files is here: https://icalendar.org/.

This post explains how to deal with creating the file and downloading it from within a JS client.

Note: You want to set a data content type of: 'text/calendar;charset=utf-8;'.

like image 59
Derek Dowling Avatar answered Oct 12 '22 09:10

Derek Dowling