Skip to content

Conversation

@mattjohnsonpint
Copy link
Contributor

@mattjohnsonpint mattjohnsonpint commented Apr 2, 2021

Resolves #50305

For wasm, the StandardName and DaylightName properties of the UTC time zone and all aliases of UTC will simply be "UTC".

The DisplayName property for UTC and its aliases will follow the same rules as all other display names in wasm in that they use the offset followed by the ID, except that we will also honor the convention from all other targets where the offset string for UTC is "(UTC)" rather than "(UTC+00:00)" (This convention is carried over from the established convention in the Windows OS time zone data, as it helps prevent users from picking a different time zone like London that has DST.)

So, with this change, TimeZoneInfo.Utc.DisplayName is "(UTC) UTC", which may seem redundant in isolation but aligns well with the format used by other time zones such as "(UTC-08:00) America/Los_Angeles" - so works well in a list.

Aliases of UTC will retain their requested IDs, such as TimeZoneInfo.FindSystemTimeZoneById("Etc/UTC").DisplayName which will now be "(UTC) Etc/UTC".

This affects the browser target only. Some minor refactoring was done for consistency of the code, but results in no behavioral changes or visible changes in the output strings of other targets.

@eerhardt @tarekgh @lewing

@ghost
Copy link

ghost commented Apr 2, 2021

I couldn't figure out the best area label to add to this PR. If you have write-permissions please help me learn by adding exactly one area label.

@tarekgh tarekgh added arch-wasm WebAssembly architecture area-System.Runtime labels Apr 2, 2021
@ghost
Copy link

ghost commented Apr 2, 2021

Tagging subscribers to 'arch-wasm': @lewing
See info in area-owners.md if you want to be subscribed.

Issue Details

Resolves #50305

For wasm, the StandardName and DaylightName properties of the UTC time zone and all aliases of UTC will simply be "UTC".

The DisplayName property for UTC and its aliases will follow the same rules as all other display names in wasm in that they use the offset followed by the ID, except that we will also honor the convention from all other targets where the offset string for UTC is "(UTC)" rather than "(UTC+00:00)" (This convention is carried over from the established convention in the Windows OS time zone data, as it helps prevent users from picking a different time zone like London that has DST.)

So, with this change, TimeZoneInfo.Utc.DisplayName is "(UTC) UTC", which may seem redundant in isolation but aligns well with the format used by other time zones such as "(UTC-08:00) America/Los_Angeles" - so works well in a list.

Aliases of UTC will retain their requested IDs, such as TimeZoneInfo.FindSystemTimeZoneById("Etc/Utc").DisplayName which will now be "(UTC) Etc/Utc".

This affects the browser target only. Some minor refactoring was done for consistency of the code, but results in no behavioral changes or visible changes in the output strings of other targets.

@eerhardt @tarekgh @lewing

Author: mattjohnsonpint
Assignees: -
Labels:

arch-wasm, area-System.Runtime

Milestone: -

Copy link
Member

@eerhardt eerhardt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:shipit:

@tarekgh tarekgh merged commit 2b09eb6 into dotnet:main Apr 7, 2021
@mattjohnsonpint mattjohnsonpint deleted the browser-utc branch April 7, 2021 20:32
@ghost ghost locked as resolved and limited conversation to collaborators May 7, 2021
@karelz karelz added this to the 6.0.0 milestone May 20, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

arch-wasm WebAssembly architecture area-System.DateTime

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[WASM] TimeZoneInfo UTC display names

5 participants