Use the new olson_from_tzstring() function to extract the Olson tz.

This commit is contained in:
Andrew McMillan 2010-04-15 20:25:32 +12:00
parent 0ada660a8c
commit e15c3d3b58

View File

@ -49,15 +49,19 @@ class RepeatRuleTimeZone extends DateTimeZone {
} }
catch (Exception $e) { catch (Exception $e) {
$original = $dtz; $original = $dtz;
if ( preg_match( '{((([^/]+)/)?[^/]+)$}', $dtz, $matches ) ) { $dtz = olson_from_tzstring($dtz);
$dtz = $matches[1]; if ( isset($dtz) ) {
dbg_error_log( 'RRule', 'Found timezone "%s", will process as "%s"', $original, $dtz ); try {
parent::__construct($dtz);
$this->tzid = $dtz;
}
catch (Exception $e) {
dbg_error_log( 'ERROR', 'Could not parse timezone "%s" - will use floating time', $original );
$dtz = new DateTimeZone('UTC');
$this->tzid = false;
}
} }
try { else {
parent::__construct($dtz);
$this->tzid = $dtz;
}
catch (Exception $e) {
dbg_error_log( 'ERROR', 'Could not parse timezone "%s" - will use floating time', $original ); dbg_error_log( 'ERROR', 'Could not parse timezone "%s" - will use floating time', $original );
$dtz = new DateTimeZone('UTC'); $dtz = new DateTimeZone('UTC');
$this->tzid = false; $this->tzid = false;