If you're thinking "My site would be better if it had an ics export! That spec looks simple, I can just render some text!"
STOP

I have seen dozens of custom ICal implementations.
NONE of them have ever output valid ICal so far.
Use a library, and pray that it's only a bit wrong.