简体   繁体   中英

PHP generated ICS file not working properly

I have the following ics file being generated on the fly by a php function. I'm having several issues with the file. On desktop, uploading to google calendar or outlook the time is off by 4 hours. On IOS the file works great, on Android the calendar errors with "No Valid Items".

I do not know much about ics files, and am attempting to learn. Any point in the right direction is greatly appreciated.

First thing I'd like to fix is the time issue, why is the file not telling desktop apps the correct time?

Second thing is the "No Valid Items" on android.

 BEGIN:VCALENDAR VERSION:2.0 PRODID:-//Example Site //NONSGML Events //EN CALSCALE:GREGORIAN X-WR-CALNAME:Example Site BEGIN:VTIMEZONE TZID:America/New_York X-LIC-LOCATION:America/New_York BEGIN:DAYLIGHT TZOFFSETFROM:-0500 TZOFFSETTO:-0400 TZNAME:EDT DTSTART:19700308T020000 RRULE:FREQ=YEARLY;BYMONTH=3;BYDAY=2SU END:DAYLIGHT BEGIN:STANDARD TZOFFSETFROM:-0400 TZOFFSETTO:-0500 TZNAME:EST DTSTART:19701101T020000 RRULE:FREQ=YEARLY;BYMONTH=11;BYDAY=1SU END:STANDARD END:VTIMEZONE BEGIN:VEVENT CREATED:20160901T125454 UID:50 DTEND;TZID=America/New_York:20160907T210000 DTSTART;TZID=America/New_York:20160907T120000Z DTSTAMP:20160908T154347Z LOCATION:1234 Avenue Orlando\\, FL 32803 DESCRIPTION: SUMMARY:Orientation ORGANIZER;MAILTO:example@example.org URL;VALUE=URI:http://example.site/schedule TRANSP:OPAQUE BEGIN:VALARM ACTION:DISPLAY TRIGGER;VALUE=DATE-TIME:20160907T000000 DESCRIPTION:Orientation END:VALARM END:VEVENT END:VCALENDAR 

I happened to find an answer by comparing an ics file that worked, from another website with what I had. I used an iCalendar Validator http://severinghaus.org/projects/icv/ to find the errors and discovered that the Organizer also required a name:

 ORGANIZER;CN=Example Name:MAILTO:example@example.com 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM