让 Google 日历尊重 iCal 时区时遇到问题
我构建了一个 iCal feed,可以在 Apple 日历中完美运行。然后我尝试将其导入 Google 日历,时间都相差五个小时,这是有道理的,因为我位于美国/东部时区。我从 ical 规范中假设日历程序应该根据它们的格式(它们没有时区或 UTC 标签)将我的时间视为当地时间,但这并没有发生。因此,我将时区信息添加到日历中。
BEGIN:VCALENDAR
CALSCALE:GREGORIAN
METHOD:PUBLISH
PRODID:iCalendar-Ruby VERSION:2.0
BEGIN:VTIMEZONE
TZID:America/New_York
BEGIN:DAYLIGHT
DTSTART:19700308T020000
RRULE:FREQ=YEARLY;BYMONTH=3;BYDAY=2SU
TZNAME:EDT
TZOFFSETFROM:-0500
TZOFFSETTO:-0400
END:DAYLIGHT
BEGIN:STANDARD
DTSTART:19701101T020000
RRULE:FREQ=YEARLY;BYMONTH=11;BYDAY=1SU
TZNAME:EST
TZOFFSETFROM:-0400
TZOFFSETTO:-0500
END:STANDARD
END:VTIMEZONE
我删除了日历并重新导入,时间仍然不对。标准事件如下所示:
BEGIN:VEVENT
DESCRIPTION:Justin M. is scheduled to work from 12 PM to 3 PM.
DTEND:20111103T150000
DTSTAMP:20111122T144545
DTSTART:20111103T120000
LOCATION:Museum of Unnatural History
SEQUENCE:0
SUMMARY:Justin M.
UID:2011-11-22T14:45:45+00:00_239255930@0a9a698e-854d-48e2-97d4-37ff0b28311 9
END:VEVENT
所以,我不确定为什么 Google 日历出现问题。是否可能只是缓存 URL 而不是真正更新日历?还有什么我应该做的吗?
I've built an iCal feed that works perfectly in Apple's Calendar. Then I tried importing it into Google Calendar and the times are all five hours off, which makes sense because I'm in the US/Eastern timezone. I had assumed from the ical specs that the calendar program should respect my times as local times, bases on how they're formatted (they don't have timezone or UTC tags), but that's not happening. So, I added time zone information to the calendar.
BEGIN:VCALENDAR
CALSCALE:GREGORIAN
METHOD:PUBLISH
PRODID:iCalendar-Ruby VERSION:2.0
BEGIN:VTIMEZONE
TZID:America/New_York
BEGIN:DAYLIGHT
DTSTART:19700308T020000
RRULE:FREQ=YEARLY;BYMONTH=3;BYDAY=2SU
TZNAME:EDT
TZOFFSETFROM:-0500
TZOFFSETTO:-0400
END:DAYLIGHT
BEGIN:STANDARD
DTSTART:19701101T020000
RRULE:FREQ=YEARLY;BYMONTH=11;BYDAY=1SU
TZNAME:EST
TZOFFSETFROM:-0400
TZOFFSETTO:-0500
END:STANDARD
END:VTIMEZONE
I deleted an reimported the calendar, and the times are still off. A standard event looks like this:
BEGIN:VEVENT
DESCRIPTION:Justin M. is scheduled to work from 12 PM to 3 PM.
DTEND:20111103T150000
DTSTAMP:20111122T144545
DTSTART:20111103T120000
LOCATION:Museum of Unnatural History
SEQUENCE:0
SUMMARY:Justin M.
UID:2011-11-22T14:45:45+00:00_239255930@0a9a698e-854d-48e2-97d4-37ff0b28311 9
END:VEVENT
So, I'm not sure why Google calendar is having trouble. Is it maybe just caching the URL and not really updating the calendar? Is there something else I should doing.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以在每个事件日期中指定特定的时区,例如,
这样将自动考虑夏令时,并且在创建日历时无需将当地时间转换为 UTC (Z) 格式。请注意,如果解释 ical 文件的客户端没有正确的区域设置,您也可能会遇到时区问题。
You can specify a specific time zone in each event date, e.g.
That way Daylight Time will be taken into consideration automatically and you don't have to convert from local times to UTC (Z) format when creating the calendar. Note you can also run into time zone issues if the client that interprets the ical file doesn't have its zone setting right.
因此,我通过在每个事件时间末尾添加
Z
来使用 UTC 时间。结合日历中的时区信息,Google 可以正确转换时间——夏令时除外。那些仍然关闭。如果我能找出原因,就会更新。So, I resorted to using UTC times by adding a
Z
to the end of each event time. Coupled with the Time Zone information in the calendar, Google is correctly converting the times -- except for daylight time. Those are still off. Will update if I can figure out why.