I am trying to get my calendar from a groupware-server (ics file) parsed using php. So far so good except for the possibility to define additional timezones per ical event entry:
DTSTART;TZID="Amsterdam, Belgrade, Berlin, Brussels, Budapest, Madrid, Paris, Prague, Stockholm":20110723T193000
DTEND;TZID="Amsterdam, Belgrade, Berlin, Brussels, Budapest, Madrid, Paris, Prague, Stockholm":20110724T000000
Another event is i.e. in
DTSTART;TZID="Greenland (Danmarkshavn)":20120523T193000
DTEND;TZID="Greenland (Danmarkshavn)":20120524T000000
The problem is that the common parser classes found online just strip those TZID parameter which results in moving the event to the timestamp at the end of the string.
Is there any parser for php taking care of that issue?
Updated answer:
sabre/vobject has a pretty extensive list of timezone mappings like this, to map to their olson counterparts. Full list here.
But it doesn't look like the specific strings you've found are in that.
iCalendar objects that are standards compliant should actually also contain a VTIMEZONE
object, above the VEVENT object. The information in the VTIMEZONE
object helps parsers such as vobject figure out what the intended timezone was.
If you don't see VTIMEZONE
anywhere in the source, it means that the groupware server you're using is producing broken iCalendar files. I'd recommend filing a bug suggesting this. There's many applications that produce iCalendar that do not include VTIMEZONE
, but these applications tend to use the Olson identifier (such as Europe/Amsterdam
) which is very widely supported.
you should have a look at: http://www.phpclasses.org/browse/file/16660.html
according to this thread it handles TZID: ICalendar parser in PHP that supports timezones