SG-iCalendar icon indicating copy to clipboard operation
SG-iCalendar copied to clipboard

Timezone ID issue.

Open echo66 opened this issue 13 years ago • 5 comments

Greetings. I'm trying to use this parser with Yii framework but a strange problem is happening. When i load the ics file, outside the framework project directory, i get the entire calendar displayed in the demo. But, when i try to load it within the framework, i get this error:

"date_default_timezone_set(): Timezone ID '/mozilla.org/20071231_1/Europe/London' is invalid"

the ics file is this one: http://www.gulbenkian.pt/calendar/eventos.ics

echo66 avatar May 10 '11 03:05 echo66

I don't think this is related to SG-iCalendar. I think it's related to how your timezone is configured in your framework. To confirm, figure out where the call to date_default_timezone_set is..

fangel avatar May 10 '11 07:05 fangel

the call is within the class SG_iCal_VEvent, in the construct method

echo66 avatar May 10 '11 15:05 echo66

more exactly, in this function:

protected function setLineTimeZone(SG_iCal_Line $line) { 264 if( isset($line['tzid']) ) { 265 if (!isset($this->previous_tz)) { 266 $this->previous_tz = @ date_default_timezone_get(); 267 } 268 $this->tzid = $line['tzid']; 269 date_default_timezone_set($this->tzid); 270 return true; 271 } 272 return false; 273 }

in line 269

echo66 avatar May 10 '11 15:05 echo66

I believe that this is actually a combination of the ical source and a naive mapping to PHP timezones.

I exported an ical file from Outlook which set the tzid to "Central Standard Time". This is not a supported PHP timezone (http://www.php.net/manual/en/timezones.php).

I don't think there's any perfect solution to this problem. Perhaps adding a way to register a mapping would work.

crempp avatar Jul 31 '12 19:07 crempp

Upon further investigation I found a standard mapping of Windows timezone names to tzid names https://github.com/fangel/SG-iCalendar/

echo66's problem seems to be from a different (non-standard) timezone naming scheme.

I'm not sure what the best way to handle this would be.

crempp avatar Jul 31 '12 20:07 crempp