Skip to content

Add functionality for adding VTIMEZONE from a standard set #74

@csandman

Description

@csandman

I only recently started looking into generating .ics files for a project at work where I'm creating event calendar files to include with tickets for a show in an email. One thing I've seen in my research is including VTIMEZONE info in their calendar files to indicate the original timezone the event is in. Here's an example from an exported Google Calendar:

BEGIN:VTIMEZONE
TZID:America/New_York
X-LIC-LOCATION:America/New_York
BEGIN:DAYLIGHT
TZOFFSETFROM:-0500
TZOFFSETTO:-0400
TZNAME:EDT
DTSTART:19700308T020000
RRULE:FREQ=YEARLY;BYMONTH=3;BYDAY=2SU
END:DAYLIGHT
BEGIN:STANDARD
TZOFFSETFROM:-0400
TZOFFSETTO:-0500
TZNAME:EST
DTSTART:19701101T020000
RRULE:FREQ=YEARLY;BYMONTH=11;BYDAY=1SU
END:STANDARD
END:VTIMEZONE

There is a standard set of these timezones that come from https://www.tzurl.org/ that cover all standard IANA timezone codes, and it would be really cool if there could be some functionality in this package to set these values based on passing in a code.

I was thinking something along the lines of this right before you make your first VEVENT (which I think is the standard place to put it?):

cal.SetVtimezone("America/New_York")

Alternatively, you could have some constants set up like ics.TimezoneAmerica_NewYork, or use the time.LoadLocation functionality:

America_NewYork, err := time.LoadLocation("America/New_York")

And this would set the start/end and all of the contents of the VTIMEZONE info.

I've found a couple of node packages that do something similar, and I don't think it would be too difficult to use some of their logic to port their functionality, but I'm also new to Go, so correct me if I'm wrong.

Here's what I found for a similar purpose:

Idk if this is outside the scope of what you'd like to do with this package, but I think it would be a really cool feature to have! I could also look into making a PR for this, but I'd like to get your thoughts first.

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions