-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
Time Zone IANA Ids to/From Windows Ids conversion APIs #49407
Comments
I couldn't figure out the best area label to add to this issue. If you have write-permissions please help me learn by adding exactly one area label. |
This comment has been minimized.
This comment has been minimized.
This (along with the other) should help address #18644, and reduce the need for my TimeZoneConverter library. I have functions very similar to these in that library. |
To add some supporting details for motivation, there are some scenarios that require such conversion functionality.
I'm sure I'm forgetting several other cases. I believe there was something about wanting support for this in Unity - perhaps something around leaderboard cutoff times and/or multiplayer games with users from various time zones. I can't recall the exact details. |
namespace System
{
public partial class TimeZoneInfo
{
public bool HasIanaId { get; }
public static bool TryConvertIanaIdToWindowsId(string ianaId, out string windowsId);
public static bool TryConvertWindowsIdToIanaId(string windowsId, out string ianaId);
public static bool TryConvertWindowsIdToIanaId(string windowsId, string region, out string ianaId);
}
} |
In particular, |
Background and Motivation
It is planned in 6.0 release to start supporting the IANA time zone Ids on Windows and support Windows Ids on non-Windows platforms (e.g. Linux). That will allow users to use any time zone Id across all platforms without worrying what Id work on what platform.
In addition to that, users need to be able to convert any Windows Id to IANA Id and vice versa. The proposal here is to provide the needed APIs to do that.
As we are using ICU library for supporting IANA Ids and the conversion, we'll be limited to provide this functionality only when running with ICU. i.e. this functionality is not going to be supported in the Globalization Invariant mode nor when enabling NLS mode on Windows. Because of this limitation, the proposed APIs is using
TryConvert
pattern to allow users check for the conversion failures without throwing any exception.Proposed API
The text was updated successfully, but these errors were encountered: