-
Notifications
You must be signed in to change notification settings - Fork 5.3k
[Android] Filter UTC aliases from GetSystemTimeZones to avoid duplicate display names #121964
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
Conversation
… names Co-authored-by: simonrozsival <[email protected]>
| // Skip UTC aliases to avoid duplicate display names in the list. | ||
| // UTC is already added to the dictionary at the start, and aliases like | ||
| // UCT, Etc/UTC, Zulu, etc. have the same display name as UTC. | ||
| if (IsUtcAlias(timeZoneId)) |
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.
IsUtcAlias can also be simplified:
private static bool IsUtcAlias(string id) => id[0] switch
{
'e' or 'E' => string.Equals(id, "Etc/UTC", StringComparison.OrdinalIgnoreCase) ||
string.Equals(id, "Etc/UCT", StringComparison.OrdinalIgnoreCase) ||
string.Equals(id, "Etc/Universal", StringComparison.OrdinalIgnoreCase) ||
string.Equals(id, "Etc/Zulu", StringComparison.OrdinalIgnoreCase),
'u' or 'U' => string.Equals(id, "UCT", StringComparison.OrdinalIgnoreCase) ||
string.Equals(id, "UTC", StringComparison.OrdinalIgnoreCase) ||
string.Equals(id, "Universal", StringComparison.OrdinalIgnoreCase),
'z' or 'Z' => string.Equals(id, "Zulu", StringComparison.OrdinalIgnoreCase),
_ => false
};
It is unrelated? |
Yes, copilot got it wrong. Edited. |
|
I don't think this is the right fix. We have the issue #90269 tracking ensuring not returning any duplicates on Android. When this issue get fixed should include UTC alias duplicate too. The change in this PR will add extra overhead for other platforms which is not necessary. I would say disable the failing test on Android for now. |
|
Tagging subscribers to 'arch-android': @vitek-karas, @simonrozsival, @steveisok, @akoeplinger |
|
@simonrozsival could you please ensure disabling the failing test for Android platform then close #121963 to avoid skipping failures on other platforms? Thanks! |
|
@tarekgh yes, I will disable the test tomorrow |
TimeZoneInfoTests.TestGetSystemTimeZonesfails on Android becauseGetSystemTimeZones()returns UTC aliases (UCT, Etc/UTC, Zulu, etc.) alongside UTC, all sharing the same display name "(UTC) Coordinated Universal Time".Changes
PopulateAllSystemTimeZonesusing existingIsUtcAlias()checkFixes #121963
Original prompt
System.Tests.TimeZoneInfoTests.TestGetSystemTimeZonesfailure: Assert.DoesNotContain #121963✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.