I use NodaTime to do time zone conversions in ical.net, because it performs much better than the previous implementation which tried to use the VTIMEZONE
element to handle time changes and time zone conversions.
Under the hood, this method is pretty important for performance: it drops the test suite runtime from about 6 seconds to around 2.5.
public static DateTimeZone GetZone(string tzId)
{
// IANA lookup attempt
zone = DateTimeZoneProviders.Bcl.GetZoneOrNull(tzId);
if (zone != null)
{
return zone;
}
// Serialization lookup attempt
// Some other tricks to find a reasonable time zone, etc.
}
The .NET Core implementation of NodaTime does not have Bcl
as a DateTimeZoneProvider
. (It still has Tzdb
and Serialization
.) I poked around in the NodaTime source a bit, but I wasn't sure what the replacement was meant to be, if any.
What should we be using for BCL time zone lookups in the .NET Core port of NodaTime?