-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[wasm] Use timezone abbreviations as fallback if full names don't exist #45385
Changes from 8 commits
eac0385
a040a7e
429689e
93c0f35
9b4230a
33ff298
1805c6d
c0d5599
8478bee
3524f6a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1074,7 +1074,7 @@ | |
<Compile Include="$(CommonPath)Interop\Interop.TimeZoneDisplayNameType.cs"> | ||
<Link>Common\Interop\Interop.TimeZoneDisplayNameType.cs</Link> | ||
</Compile> | ||
<Compile Include="$(CommonPath)Interop\Interop.TimeZoneInfo.cs" Condition="'$(TargetsBrowser)' != 'true'"> | ||
<Compile Include="$(CommonPath)Interop\Interop.TimeZoneInfo.cs"> | ||
<Link>Common\Interop\Interop.TimeZoneInfo.cs</Link> | ||
</Compile> | ||
<Compile Include="$(CommonPath)Interop\Interop.Utils.cs"> | ||
|
@@ -1865,7 +1865,7 @@ | |
<Compile Include="$(MSBuildThisFileDirectory)System\Environment.Browser.cs" /> | ||
<Compile Include="$(MSBuildThisFileDirectory)System\IO\DriveInfoInternal.Browser.cs" /> | ||
<Compile Include="$(MSBuildThisFileDirectory)System\IO\PersistedFiles.Browser.cs" /> | ||
<Compile Include="$(MSBuildThisFileDirectory)System\TimeZoneInfo.GetDisplayName.Invariant.cs" /> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Delete this file since it is no longer used? Also, |
||
<Compile Include="$(MSBuildThisFileDirectory)System\TimeZoneInfo.GetDisplayName.cs" /> | ||
</ItemGroup> | ||
<ItemGroup Condition="'$(IsOSXLike)' == 'true'"> | ||
<Compile Include="$(CommonPath)Interop\OSX\Interop.libobjc.cs"> | ||
|
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -81,6 +81,28 @@ public static void Names() | |
Assert.NotNull(utc.ToString()); | ||
} | ||
|
||
// Due to ICU size limitations, full daylight/standard names are not included. | ||
// name abbreviations, if available, are used instead | ||
public static TheoryData<TimeZoneInfo, string, string, string> GetBrowser_TimeZoneNamesTestData() | ||
{ | ||
return new TheoryData<TimeZoneInfo, string, string, string> | ||
{ | ||
{ TimeZoneInfo.FindSystemTimeZoneById(s_strPacific), "(UTC-08:00) PST", "PST", "PDT" }, | ||
{ TimeZoneInfo.FindSystemTimeZoneById(s_strSydney), "(UTC+10:00) AEST", "AEST", "AEDT" }, | ||
{ TimeZoneInfo.FindSystemTimeZoneById(s_strPerth), "(UTC+08:00) AWST", "AWST", "AWDT" }, | ||
{ TimeZoneInfo.FindSystemTimeZoneById(s_strIran), "(UTC+03:30) +0330", "+0330", "+0430" }, | ||
|
||
{ s_NewfoundlandTz, "(UTC-03:30) NST", "NST", "NDT" }, | ||
{ s_catamarcaTz, "(UTC-03:00) -03", "-03", "-02" } | ||
}; | ||
} | ||
|
||
[ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsBrowser))] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Instead of checking PlatformDetection.IsBrowser here can you make a Platform_TimeZoneNamesTestData that returns different data for IsBrowser so that we are testing both cases and verify that we haven't regressed the normal case? |
||
[MemberData(nameof(GetBrowser_TimeZoneNamesTestData))] | ||
public static void Browser_TimeZoneNames(TimeZoneInfo tzi, string displayName, string standardName, string daylightName) | ||
=> Assert.Equal($"DisplayName: {tzi.DisplayName}, StandardName: {tzi.StandardName}, DaylightName: {tzi.DaylightName}", | ||
$"DisplayName: {displayName}, StandardName: {standardName}, DaylightName: {daylightName}"); | ||
|
||
[Fact] | ||
public static void ConvertTime() | ||
{ | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why is this changed needed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because we aren't using
TimeZoneInfo.GetDisplayName.Invariant.cs
anymore (will also remove that file in this PR) soInterop.Globalization
is not defined for Browser