导入到 Google 或 Outlook 时,ICS 时区无法正确转换
ICS timezones not converting correctly when importing to Google or Outlook
我生成了 ICS 文件,每个事件都在 9 AM 开始并在 5 PM 太平洋时间(UTC-8)[=27] =].转换为我的当地时间 ( GMT+4 ) 时,它应该显示事件为 10 PM - 6 AM,而不是 Google 和 Outlook 也将其转换为 晚上 8 点 - 凌晨 4 点。
我已经尝试调整日光和标准的 TZOFFSETFROM 和 TZOFFSETTO 设置,以显示正确的转换,但它只有对 Outlook 的影响 - Google 日历似乎完全忽略了这些设置。但是,无论如何更改 Outlook 的设置对我来说似乎是错误的,因为最初它们具有正确的太平洋时间设置?
附上ICS文件的代码。
VERSION:2.0
PRODID:-//Foobar Corporation//NONSGML Foobar//EN
CALSCALE:GREGORIAN
METHOD:PUBLISH
X-WR-CALNAME:EnergyPlex
X-WR-TIMEZONE:America/Los_Angeles
BEGIN:VTIMEZONE
TZID:America/Los_Angeles
X-LIC-LOCATION:America/Los_Angeles
BEGIN:DAYLIGHT
TZOFFSETFROM:-0800
TZOFFSETTO:-0700
TZNAME:PDT
DTSTART:19700308T020000
RRULE:FREQ=YEARLY;BYMONTH=3;BYDAY=2SU
END:DAYLIGHT
BEGIN:STANDARD
TZOFFSETFROM:-0700
TZOFFSETTO:-0800
TZNAME:PST
DTSTART:19701101T020000
RRULE:FREQ=YEARLY;BYMONTH=11;BYDAY=1SU
END:STANDARD
END:VTIMEZONE
BEGIN:VEVENT
UID:20190709T133817-12030501-example.com
DTSTAMP:20190709T133817
DTSTART;TZID=America/Los_Angeles:20190722T090000
DTEND;TZID=America/Los_Angeles:20190722T170000
SUMMARY:Energyplex Day Camp for Jenny Doe
DESCRIPTION: Your child is booked for a camp on this day.
END:VEVENT
BEGIN:VEVENT
UID:20190709T133817-422290764-example.com
DTSTAMP:20190709T133817
DTSTART;TZID=America/Los_Angeles:20190723T090000
DTEND;TZID=America/Los_Angeles:20190723T170000
SUMMARY:Energyplex Day Camp for Jenny Doe
DESCRIPTION: Your child is booked for a camp on this day.
END:VEVENT
BEGIN:VEVENT
UID:20190709T133817-847881910-example.com
DTSTAMP:20190709T133817
DTSTART;TZID=America/Los_Angeles:20190724T090000
DTEND;TZID=America/Los_Angeles:20190724T170000
SUMMARY:Energyplex Day Camp for Jenny Doe
DESCRIPTION: Your child is booked for a camp on this day.
END:VEVENT
BEGIN:VEVENT
UID:20190709T133817-1093239879-example.com
DTSTAMP:20190709T133817
DTSTART;TZID=America/Los_Angeles:20190725T090000
DTEND;TZID=America/Los_Angeles:20190725T170000
SUMMARY:Energyplex Day Camp for Jenny Doe
DESCRIPTION: Your child is booked for a camp on this day.
END:VEVENT
BEGIN:VEVENT
UID:20190709T133817-190860610-example.com
DTSTAMP:20190709T133817
DTSTART;TZID=America/Los_Angeles:20190726T090000
DTEND;TZID=America/Los_Angeles:20190726T170000
SUMMARY:Energyplex Day Camp for Jenny Doe
DESCRIPTION: Your child is booked for a camp on this day.
END:VEVENT
END:VCALENDAR
预期结果是在 Outlook 和 Google 日历上显示 10 PM - 6 AM 的事件 GMT+4 时区。
根据您提供的信息,您的假设是错误的。两者都显示正确的时间:
鉴于您的活动的开始和结束日期(例如,第一个活动的开始日期为 20190722T090000),America/Los_Angeles 在这些日期采用夏令时,因此采用 UTC-7。
UTC 时间的 20190722T090000 + 7h = 20190722T160000 转换为 UTC+4 时,您将得到 20190722T160000 + 4h = 20190722T200000,所以当地时间晚上 8 点。
我生成了 ICS 文件,每个事件都在 9 AM 开始并在 5 PM 太平洋时间(UTC-8)[=27] =].转换为我的当地时间 ( GMT+4 ) 时,它应该显示事件为 10 PM - 6 AM,而不是 Google 和 Outlook 也将其转换为 晚上 8 点 - 凌晨 4 点。
我已经尝试调整日光和标准的 TZOFFSETFROM 和 TZOFFSETTO 设置,以显示正确的转换,但它只有对 Outlook 的影响 - Google 日历似乎完全忽略了这些设置。但是,无论如何更改 Outlook 的设置对我来说似乎是错误的,因为最初它们具有正确的太平洋时间设置?
附上ICS文件的代码。
VERSION:2.0
PRODID:-//Foobar Corporation//NONSGML Foobar//EN
CALSCALE:GREGORIAN
METHOD:PUBLISH
X-WR-CALNAME:EnergyPlex
X-WR-TIMEZONE:America/Los_Angeles
BEGIN:VTIMEZONE
TZID:America/Los_Angeles
X-LIC-LOCATION:America/Los_Angeles
BEGIN:DAYLIGHT
TZOFFSETFROM:-0800
TZOFFSETTO:-0700
TZNAME:PDT
DTSTART:19700308T020000
RRULE:FREQ=YEARLY;BYMONTH=3;BYDAY=2SU
END:DAYLIGHT
BEGIN:STANDARD
TZOFFSETFROM:-0700
TZOFFSETTO:-0800
TZNAME:PST
DTSTART:19701101T020000
RRULE:FREQ=YEARLY;BYMONTH=11;BYDAY=1SU
END:STANDARD
END:VTIMEZONE
BEGIN:VEVENT
UID:20190709T133817-12030501-example.com
DTSTAMP:20190709T133817
DTSTART;TZID=America/Los_Angeles:20190722T090000
DTEND;TZID=America/Los_Angeles:20190722T170000
SUMMARY:Energyplex Day Camp for Jenny Doe
DESCRIPTION: Your child is booked for a camp on this day.
END:VEVENT
BEGIN:VEVENT
UID:20190709T133817-422290764-example.com
DTSTAMP:20190709T133817
DTSTART;TZID=America/Los_Angeles:20190723T090000
DTEND;TZID=America/Los_Angeles:20190723T170000
SUMMARY:Energyplex Day Camp for Jenny Doe
DESCRIPTION: Your child is booked for a camp on this day.
END:VEVENT
BEGIN:VEVENT
UID:20190709T133817-847881910-example.com
DTSTAMP:20190709T133817
DTSTART;TZID=America/Los_Angeles:20190724T090000
DTEND;TZID=America/Los_Angeles:20190724T170000
SUMMARY:Energyplex Day Camp for Jenny Doe
DESCRIPTION: Your child is booked for a camp on this day.
END:VEVENT
BEGIN:VEVENT
UID:20190709T133817-1093239879-example.com
DTSTAMP:20190709T133817
DTSTART;TZID=America/Los_Angeles:20190725T090000
DTEND;TZID=America/Los_Angeles:20190725T170000
SUMMARY:Energyplex Day Camp for Jenny Doe
DESCRIPTION: Your child is booked for a camp on this day.
END:VEVENT
BEGIN:VEVENT
UID:20190709T133817-190860610-example.com
DTSTAMP:20190709T133817
DTSTART;TZID=America/Los_Angeles:20190726T090000
DTEND;TZID=America/Los_Angeles:20190726T170000
SUMMARY:Energyplex Day Camp for Jenny Doe
DESCRIPTION: Your child is booked for a camp on this day.
END:VEVENT
END:VCALENDAR
预期结果是在 Outlook 和 Google 日历上显示 10 PM - 6 AM 的事件 GMT+4 时区。
根据您提供的信息,您的假设是错误的。两者都显示正确的时间:
鉴于您的活动的开始和结束日期(例如,第一个活动的开始日期为 20190722T090000),America/Los_Angeles 在这些日期采用夏令时,因此采用 UTC-7。
UTC 时间的 20190722T090000 + 7h = 20190722T160000 转换为 UTC+4 时,您将得到 20190722T160000 + 4h = 20190722T200000,所以当地时间晚上 8 点。