Wrong Time When Importing ICS Event

北慕城南 提交于 2019-12-14 04:09:03

问题


I have a .ics file that has the following iCalendar code:

BEGIN:VCALENDAR

PRODID;X-RICAL-TZSOURCE=TZINFO:-//Company Name//NONSGML example.co
 m//EN
CALSCALE:GREGORIAN
VERSION:2.0
METHOD:PUBLISH

BEGIN:VTIMEZONE
TZID;X-RICAL-TZSOURCE=TZINFO:America/Los_Angeles
BEGIN:DAYLIGHT
DTSTART:20180311T020000
RDATE:20180311T020000
TZOFFSETFROM:-0800
TZOFFSETTO:-0700
TZNAME:PDT
END:DAYLIGHT
END:VTIMEZONE

BEGIN:VEVENT
CREATED;VALUE=DATE-TIME:20180622T002920Z
DTEND;TZID=America/Los_Angeles;VALUE=DATE-TIME:20180703T173000
DTSTART;TZID=America/Los_Angeles;VALUE=DATE-TIME:20180703T170000
DTSTAMP;VALUE=DATE-TIME:20180622T002920Z
ATTENDEE#<Client 1234 "Lorem Ipsum">
UID:id@example.com
DESCRIPTION:Super Secret Event
URL:https://example.com/path/id
SUMMARY:Super secret summary
ORGANIZER;CN=Tamer Shlash;CUTYPE=INDIVIDUAL;PARTSTAT=A
 CCEPTED:mailto:noreply@example.com
SEQUENCE:0
END:VEVENT

END:VCALENDAR

However, when I download the file on an Android device and import it, the event is off by 1 hour. Trying on a Mac or iPhone device will import the event with the correct time.

Any idea why I'm getting this weird behaviour on Android?


回答1:


Your VTIMEZONE definition for America/Los Angeles is bogus. It is missing a STANDARD component. To see what it should look like, just invite yourself to a meeting from any client and look at the resulting ics file.

Things are working on Mac/iOS because those clients tend to ignore the actual definition and just rely on the TZID=America/Los_Angeles to map it to their own definition.



来源:https://stackoverflow.com/questions/51131399/wrong-time-when-importing-ics-event

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!