diff options
author | Egor Bogatov <egorbo@gmail.com> | 2018-11-02 00:13:10 +0300 |
---|---|---|
committer | Tarek Mahmoud Sayed <tarekms@microsoft.com> | 2018-11-01 14:13:10 -0700 |
commit | d5608a7d68fc6271a1ee3d86291222c1620e40c7 (patch) | |
tree | f8b1578ccea03bd0961187da27122ba233f72fc1 | |
parent | b99629579eb4785e5fcf550d920a1e2d7b605be9 (diff) | |
download | coreclr-d5608a7d68fc6271a1ee3d86291222c1620e40c7.tar.gz coreclr-d5608a7d68fc6271a1ee3d86291222c1620e40c7.tar.bz2 coreclr-d5608a7d68fc6271a1ee3d86291222c1620e40c7.zip |
Display offset in TimeZoneInfo.DisplayName (#20728)
* Display offset in TimeZoneInfo.DisplayInfo
* Display offset in TimeZoneInfo.DisplayInfo
* prefer +00.00
* Update TimeZoneInfo.Unix.cs
-rw-r--r-- | src/System.Private.CoreLib/shared/System/TimeZoneInfo.Unix.cs | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/System.Private.CoreLib/shared/System/TimeZoneInfo.Unix.cs b/src/System.Private.CoreLib/shared/System/TimeZoneInfo.Unix.cs index 5645c2a389..ebeb301fd1 100644 --- a/src/System.Private.CoreLib/shared/System/TimeZoneInfo.Unix.cs +++ b/src/System.Private.CoreLib/shared/System/TimeZoneInfo.Unix.cs @@ -80,6 +80,14 @@ namespace System GetDisplayName(Interop.Globalization.TimeZoneDisplayNameType.Standard, ref _standardDisplayName); GetDisplayName(Interop.Globalization.TimeZoneDisplayNameType.DaylightSavings, ref _daylightDisplayName); + if (_standardDisplayName == _displayName) + { + if (_baseUtcOffset >= TimeSpan.Zero) + _displayName = $"(UTC+{_baseUtcOffset:hh\\:mm}) {_standardDisplayName}"; + else + _displayName = $"(UTC-{_baseUtcOffset:hh\\:mm}) {_standardDisplayName}"; + } + // TZif supports seconds-level granularity with offsets but TimeZoneInfo only supports minutes since it aligns // with DateTimeOffset, SQL Server, and the W3C XML Specification if (_baseUtcOffset.Ticks % TimeSpan.TicksPerMinute != 0) |