Handling arbitrary iCalendar timezones
When importing icalendar events, Chandler follows the following strategy (go
here if you want to see the Python):
- Look at the transition times in and out DST for the year in which the event starts. Compare these to those transition dates and times in all Olson timezones that have the same non-DST offset.
- It's not easy in Python to find out DST transitions, the API maps datetime -> offset, so we look at every month (in search of a DST transition), then look at every day in the transition month, etc.
- If a match is found, great, done. That's all we can really check, because iCalendar only requires a VTIMEZONE to have DST transitions if they apply to the event. In fact, if the event doesn't recur, it's legal to not include a meaningful DST timezone transition, but in practice, this matches most VTIMEZONEs
- except that Exchange is currently serializing US timezones as if the 2007 DST transitions started in 1601, so if we get an event in the past, we won't find a matching timezone. As a fallback, we check the timezone definition for 2007