Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
575 views
in Technique[技术] by (71.8m points)

timezone - Should event times specified in UTC while generating ICS files, to avoid issues with myriad calendaring applications

Handling timezones is tricky enough to say the least. And when it gets into generating ics files for scheduling meetings/events, it gets messier.

There have ben plenty of queries out on the internet, asking why the "meeting time is off by one hour after importing an ics file into outlook/google calendar, microsoft exchange server" etc.

Though i have researched quite a bit on this, including following the answers/suggestions on those trails, haven't quite figured out "the right method" of handling event time and what is the best practice around specifying timezone information in ics files.

Should it be that, the event times(start/end, recurring event times) be converted to UTC, and leave the conversion of time to correct timezone, to the consumer of ics file:Outlook, Google calendar?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

No. Most events cannot be scheduled by UTC. If it were that simple, that's how we would do it. It's a lot more intricate.

Imagine you had a meeting every day at 10:00 AM, US Pacific Time, starting January 1st. That would be 6:00 PM UTC - so you put that in your invitation and expect all to work itself out. It all works fine, until the second Sunday in March, when daylight saving time goes into effect. Your 6:00 PM UTC meeting would then line up with 11:00 AM Pacific Time - which is not how you intended the meeting to be scheduled.

But wait - it gets worse. The DST rules can actually change. This last happened in the USA in 2007, but it happens all the time in different parts of the world. Sometimes it's not just the DST that changes, but the base offset itself. If you schedule by UTC, you're setting up the expectation that everything you know about time zones will be exactly as it currently is - but nobody can predict the future.

Proper scheduling requires all of the following:

  • The original local time value of the event
  • A time zone identifier - preferably one from the IANA time zone database
  • All systems to be kept updated with time zone data updates
  • Governments to play nice and allow sufficient time for updates to be propagated

The last one is really important, and there's little you can do about it. In recent years, countries such as Egypt, Morocco, and Fiji have made changes with just a few days or a few weeks notice. Even large countries like Russia change their time zones - so you have to be prepared for updates. You can review the long history of time zone updates, and watch for future changes here.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...