Changeset View
Changeset View
Standalone View
Standalone View
src/parser/calendar/ics/PhutilICSParser.php
Show First 20 Lines • Show All 837 Lines • ▼ Show 20 Lines | private function guessTimezone($tzid) { | ||||
if (isset($map[$tzid])) { | if (isset($map[$tzid])) { | ||||
// This is a real timezone we recognize, so just use it as provided. | // This is a real timezone we recognize, so just use it as provided. | ||||
return $tzid; | return $tzid; | ||||
} | } | ||||
// These are alternate names for timezones. | // These are alternate names for timezones. | ||||
$aliases = array( | $aliases = array( | ||||
'Etc/GMT' => 'UTC', | 'Etc/GMT' => 'UTC', | ||||
// See T11816#200486. | |||||
'W. Europe Standard Time' => 'Europe/Berlin', | |||||
); | ); | ||||
if (isset($aliases[$tzid])) { | if (isset($aliases[$tzid])) { | ||||
return $aliases[$tzid]; | return $aliases[$tzid]; | ||||
} | } | ||||
// Look for something that looks like "UTC+3" or "GMT -05.00". If we find | // Look for something that looks like "UTC+3" or "GMT -05.00". If we find | ||||
// anything | // anything, pick a timezone with that offset. | ||||
$offset_pattern = | $offset_pattern = | ||||
'/'. | '/'. | ||||
'(?:UTC|GMT)'. | '(?:UTC|GMT)'. | ||||
'\s*'. | '\s*'. | ||||
'(?P<sign>[+-])'. | '(?P<sign>[+-])'. | ||||
'\s*'. | '\s*'. | ||||
'(?P<h>\d+)'. | '(?P<h>\d+)'. | ||||
'(?:'. | '(?:'. | ||||
▲ Show 20 Lines • Show All 46 Lines • Show Last 20 Lines |