Outlook时区与ics文件有关。文件在Google日历,MacOS等中加载正常

时间:2017-07-20 00:49:59

标签: time outlook timezone icalendar

在Outlook中加载此文件会显示从PT上午1:30开始而非PT上午0:30(以及BST上午9:30而非BST上午8:30)开始的事件。将其加载到Google日历中会按预期加载时间。

根据timeanddate.com,这是正确的时间:https://www.timeanddate.com/worldclock/converted.html?iso=20171019T0830&p1=136&p2=137&p3=0

任何想法可能是什么原因?

该文件由icalendar 2.0(一个红宝石宝石)制作 - 我也很乐意为此提供代码。

BEGIN:VCALENDAR VERSION:2.0 PRODID:icalendar-ruby CALSCALE:GREGORIAN BEGIN:VTIMEZONE TZID:Europe/London BEGIN:DAYLIGHT DTSTART:19711031T020000 TZOFFSETFROM:+0100 TZOFFSETTO:+0000 RRULE:FREQ=YEARLY;BYDAY=-1SU;BYMONTH=10 TZNAME:GMT END:DAYLIGHT BEGIN:STANDARD DTSTART:19681027T000000 TZOFFSETFROM:+0100 TZOFFSETTO:+0100 RRULE:FREQ=YEARLY;BYDAY=-1SU;BYMONTH=10 TZNAME:BST END:STANDARD END:VTIMEZONE BEGIN:VEVENT DTSTAMP:20170720T004211Z UID:72e941fa-eb92-4740-b0b2-50cab1d6c536 DTSTART;TZID=Europe/London:20171019T083000 DTEND;TZID=Europe/London:20171019T190000 DESCRIPTION:Event description LOCATION:London\, United Kingdom SUMMARY:London ics test END:VEVENT END:VCALENDAR

编辑:

我在我的代码中修复了一个错误,它在设置时区之前导致了一个空的开始日期。生成的ics文件如下:

我是否正确理解了VTIMEZONE日期的含义?

BEGIN:VCALENDAR
VERSION:2.0
PRODID:icalendar-ruby
CALSCALE:GREGORIAN
BEGIN:VTIMEZONE
TZID:Europe/London
BEGIN:DAYLIGHT
DTSTART:20170326T020000    <-- daylight savings start for THIS event's dates
TZOFFSETFROM:+0000
TZOFFSETTO:+0100
RRULE:FREQ=YEARLY;BYDAY=-1SU;BYMONTH=3
TZNAME:BST
END:DAYLIGHT
BEGIN:STANDARD             
DTSTART:20171029T010000   <-- daylight savings end for THIS event's dates
TZOFFSETFROM:+0100
TZOFFSETTO:+0000
RRULE:FREQ=YEARLY;BYDAY=-1SU;BYMONTH=10
TZNAME:GMT
END:STANDARD
END:VTIMEZONE
BEGIN:VEVENT
DTSTAMP:20170720T171429Z
UID:5cfa170a-9df1-4a05-a2e1-050888f48e4b
DTSTART;TZID=Europe/London:20171019T083000  <-- TZID ignored by outlook but used by apple and google calendars... I presume they have daytime savings info built in?
DTEND;TZID=Europe/London:20171019T190000     -- Outlook takes the date part and calculates offset based on the timezone section?
DESCRIPTION:Event description
LOCATION:London\, United Kingdom
SUMMARY:London ics test
END:VEVENT
END:VCALENDAR

1 个答案:

答案 0 :(得分:0)

您从哪里获得此VTIMEZONE定义?这完全是假的:DAYLIGHT和STANDARD切换都在十月份,而TZOFFSETFROM / TZOFFSETTO在STANDARD的情况下具有相同的值。

与忽略VTIMEZONE的其他客户端不同,如果它们已知,则只依赖于TZID,Outlook确实关心(也因为它不使用相同的TZID值)。

尝试使用以下内容:

BEGIN:VTIMEZONE
TZID:Europe/London
BEGIN:DAYLIGHT
TZOFFSETFROM:+0000
TZOFFSETTO:+0100
TZNAME:BST
DTSTART:19700329T010000
RRULE:FREQ=YEARLY;BYMONTH=3;BYDAY=-1SU
END:DAYLIGHT
BEGIN:STANDARD
TZOFFSETFROM:+0100
TZOFFSETTO:+0000
TZNAME:GMT
DTSTART:19701025T020000
RRULE:FREQ=YEARLY;BYMONTH=10;BYDAY=-1SU
END:STANDARD
END:VTIMEZONE