nwcell / ics.js

A browser firendly VCS file generator written entirely in javascript!!!!!!
MIT License
614 stars 258 forks source link

How to set the time zone of an event? #54

Open raxod502 opened 6 years ago

raxod502 commented 6 years ago

When I put my events into Apple Calendar, they show up as "Time zone: Floating". This makes sense since I didn't provide any time zone to ics.js when I created the events. That leaves the question: how do I provide the time zone?

Forrest-T commented 5 years ago

This can be done with Date objects (and Date-friendly formatted strings) as described here. For example, I am writing this at 2018-09-24T22:33:13-07:00

raxod502 commented 5 years ago

Maybe I'm missing something, but that doesn't seem to fix the problem. All adding a time zone does is shift the time. It doesn't actually add a time zone, so I would still expect them to show up as "Time zone: Floating".

Forrest-T commented 5 years ago

No, I think I might have misunderstood your question. The above can be used to specify a local time in some time zone (i.e. with some offset), which can then be interpreted as "absolute time" when you import the events. I believe Google Calendar, for example, translates events to whatever local time zone you import from (or has an option to do so). On closer inspection, you are probably looking for specifying the time zone for the calendar app using VTIMEZONE, which unfortunately seems to be unimplemented right now :-(

raxod502 commented 5 years ago

Yes, I think you're right. Meanwhile there are alternative projects such as ical-generator which are probably better choices than ics.js for a number of reasons. I'm probably going to be switching.