Skip to content

Commit 46ca8dc

Browse files
author
Ren Xie Liu
committed
Add microsoft timezone map
1 parent 5e572e2 commit 46ca8dc

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

lib/TimeZoneUtil.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ class TimeZoneUtil
1616
{
1717
public static $map = null;
1818

19+
public static $microsoftMap = [
20+
'tzone://Microsoft/Utc' => 'UTC',
21+
];
22+
1923
/**
2024
* List of microsoft exchange timezone ids.
2125
*
@@ -244,7 +248,8 @@ public static function loadTzMaps()
244248
include __DIR__.'/timezonedata/lotuszones.php',
245249
include __DIR__.'/timezonedata/exchangezones.php',
246250
include __DIR__.'/timezonedata/php-workaround.php',
247-
include __DIR__.'/timezonedata/extrazones.php'
251+
include __DIR__.'/timezonedata/extrazones.php',
252+
self::$microsoftMap
248253
);
249254
}
250255

tests/VObject/TimeZoneUtilTest.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -354,4 +354,11 @@ public function testPrefixedOffsetExchangeIdentifier()
354354
$ex = new \DateTimeZone('America/New_York');
355355
$this->assertEquals($ex->getName(), $tz->getName());
356356
}
357+
358+
public function testMicrosoftMap()
359+
{
360+
$tz = TimeZoneUtil::getTimeZone('tzone://Microsoft/Utc', null, true);
361+
$ex = new \DateTimeZone('UTC');
362+
$this->assertEquals($ex->getName(), $tz->getName());
363+
}
357364
}

0 commit comments

Comments
 (0)