12 lines
573 B
C#
12 lines
573 B
C#
namespace Volcanic.AgenticCore.Extensions.GoogleCalendar;
|
|
|
|
/// <summary>Google names zones by IANA id; Windows may hand out Windows ids.</summary>
|
|
internal static class ZoneIds
|
|
{
|
|
/// <summary>The IANA id (Google's zone names), converting a Windows id when needed.</summary>
|
|
public static string Name(TimeZoneInfo zone) =>
|
|
zone.HasIanaId ? zone.Id : TimeZoneInfo.TryConvertWindowsIdToIanaId(zone.Id, out var iana) ? iana : zone.Id;
|
|
|
|
public static bool TryFind(string id, out TimeZoneInfo zone) => TimeZoneInfo.TryFindSystemTimeZoneById(id, out zone!);
|
|
}
|