From f92d8211686cd7819a7d5e6185e1e13ad9d8ba3e Mon Sep 17 00:00:00 2001 From: Kamron Batman <3953314+kamronbatman@users.noreply.github.com> Date: Fri, 19 May 2023 16:40:06 -0700 Subject: [PATCH] fix: Fixes timezone issue (#1388) ### Summary Removes the timezone specific logic in favor of globalization non-invariance. This should fix culture issues too. --- Directory.Build.props | 2 +- Distribution/Data/timezones.json | 1157 ------------------ Projects/Server/TimeZones/TimeZoneHandler.cs | 56 +- README.md | 12 +- 4 files changed, 9 insertions(+), 1218 deletions(-) delete mode 100644 Distribution/Data/timezones.json diff --git a/Directory.Build.props b/Directory.Build.props index e76bdec62e..8255af1889 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -37,7 +37,7 @@ true false true - true + false win-x64 diff --git a/Distribution/Data/timezones.json b/Distribution/Data/timezones.json deleted file mode 100644 index e61680c1ed..0000000000 --- a/Distribution/Data/timezones.json +++ /dev/null @@ -1,1157 +0,0 @@ -/* Generated from https://github.com/unicode-org/cldr/blob/main/common/supplemental/windowsZones.xml */ -[ - { - "timezone": "Dateline Standard Time", - "regions": [ - "Etc/GMT+12" - ] - }, - { - "timezone": "UTC-11", - "regions": [ - "Etc/GMT+11", - "Pacific/Pago_Pago", - "Pacific/Niue", - "Pacific/Midway" - ] - }, - { - "timezone": "Aleutian Standard Time", - "regions": [ - "America/Adak" - ] - }, - { - "timezone": "Hawaiian Standard Time", - "regions": [ - "Pacific/Honolulu", - "Pacific/Rarotonga", - "Pacific/Tahiti", - "Pacific/Johnston", - "Etc/GMT+10" - ] - }, - { - "timezone": "Marquesas Standard Time", - "regions": [ - "Pacific/Marquesas" - ] - }, - { - "timezone": "Alaskan Standard Time", - "regions": [ - "America/Anchorage", - "America/Juneau", - "America/Metlakatla", - "America/Nome", - "America/Sitka", - "America/Yakutat" - ] - }, - { - "timezone": "UTC-09", - "regions": [ - "Etc/GMT+9", - "Pacific/Gambier" - ] - }, - { - "timezone": "Pacific Standard Time (Mexico)", - "regions": [ - "America/Tijuana", - "America/Santa_Isabel" - ] - }, - { - "timezone": "UTC-08", - "regions": [ - "Etc/GMT+8", - "Pacific/Pitcairn" - ] - }, - { - "timezone": "Pacific Standard Time", - "regions": [ - "America/Los_Angeles", - "America/Vancouver", - "PST8PDT" - ] - }, - { - "timezone": "US Mountain Standard Time", - "regions": [ - "America/Phoenix", - "America/Creston", - "America/Dawson_Creek", - "America/Fort_Nelson", - "America/Hermosillo", - "Etc/GMT+7" - ] - }, - { - "timezone": "Mountain Standard Time (Mexico)", - "regions": [ - "America/Chihuahua", - "America/Mazatlan" - ] - }, - { - "timezone": "Mountain Standard Time", - "regions": [ - "America/Denver", - "America/Edmonton", - "America/Cambridge_Bay", - "America/Inuvik", - "America/Yellowknife", - "America/Ojinaga", - "America/Boise", - "MST7MDT" - ] - }, - { - "timezone": "Yukon Standard Time", - "regions": [ - "America/Whitehorse", - "America/Dawson" - ] - }, - { - "timezone": "Central America Standard Time", - "regions": [ - "America/Guatemala", - "America/Belize", - "America/Costa_Rica", - "Pacific/Galapagos", - "America/Tegucigalpa", - "America/Managua", - "America/El_Salvador", - "Etc/GMT+6" - ] - }, - { - "timezone": "Central Standard Time", - "regions": [ - "America/Chicago", - "America/Winnipeg", - "America/Rainy_River", - "America/Rankin_Inlet", - "America/Resolute", - "America/Matamoros", - "America/Indiana/Knox", - "America/Indiana/Tell_City", - "America/Menominee", - "America/North_Dakota/Beulah", - "America/North_Dakota/Center", - "America/North_Dakota/New_Salem", - "CST6CDT" - ] - }, - { - "timezone": "Easter Island Standard Time", - "regions": [ - "Pacific/Easter" - ] - }, - { - "timezone": "Central Standard Time (Mexico)", - "regions": [ - "America/Mexico_City", - "America/Bahia_Banderas", - "America/Merida", - "America/Monterrey" - ] - }, - { - "timezone": "Canada Central Standard Time", - "regions": [ - "America/Regina", - "America/Swift_Current" - ] - }, - { - "timezone": "SA Pacific Standard Time", - "regions": [ - "America/Bogota", - "America/Rio_Branco", - "America/Eirunepe", - "America/Coral_Harbour", - "America/Guayaquil", - "America/Jamaica", - "America/Cayman", - "America/Panama", - "America/Lima", - "Etc/GMT+5" - ] - }, - { - "timezone": "Eastern Standard Time (Mexico)", - "regions": [ - "America/Cancun" - ] - }, - { - "timezone": "Eastern Standard Time", - "regions": [ - "America/New_York", - "America/Nassau", - "America/Toronto", - "America/Iqaluit", - "America/Montreal", - "America/Nipigon", - "America/Pangnirtung", - "America/Thunder_Bay", - "America/Detroit", - "America/Indiana/Petersburg", - "America/Indiana/Vincennes", - "America/Indiana/Winamac", - "America/Kentucky/Monticello", - "America/Louisville", - "EST5EDT" - ] - }, - { - "timezone": "Haiti Standard Time", - "regions": [ - "America/Port-au-Prince" - ] - }, - { - "timezone": "Cuba Standard Time", - "regions": [ - "America/Havana" - ] - }, - { - "timezone": "US Eastern Standard Time", - "regions": [ - "America/Indianapolis", - "America/Indiana/Marengo", - "America/Indiana/Vevay" - ] - }, - { - "timezone": "Turks And Caicos Standard Time", - "regions": [ - "America/Grand_Turk" - ] - }, - { - "timezone": "Paraguay Standard Time", - "regions": [ - "America/Asuncion" - ] - }, - { - "timezone": "Atlantic Standard Time", - "regions": [ - "America/Halifax", - "Atlantic/Bermuda", - "America/Glace_Bay", - "America/Goose_Bay", - "America/Moncton", - "America/Thule" - ] - }, - { - "timezone": "Venezuela Standard Time", - "regions": [ - "America/Caracas" - ] - }, - { - "timezone": "Central Brazilian Standard Time", - "regions": [ - "America/Cuiaba", - "America/Campo_Grande" - ] - }, - { - "timezone": "SA Western Standard Time", - "regions": [ - "America/La_Paz", - "America/Antigua", - "America/Anguilla", - "America/Aruba", - "America/Barbados", - "America/St_Barthelemy", - "America/Kralendijk", - "America/Manaus", - "America/Boa_Vista", - "America/Porto_Velho", - "America/Blanc-Sablon", - "America/Curacao", - "America/Dominica", - "America/Santo_Domingo", - "America/Grenada", - "America/Guadeloupe", - "America/Guyana", - "America/St_Kitts", - "America/St_Lucia", - "America/Marigot", - "America/Martinique", - "America/Montserrat", - "America/Puerto_Rico", - "America/Lower_Princes", - "America/Port_of_Spain", - "America/St_Vincent", - "America/Tortola", - "America/St_Thomas", - "Etc/GMT+4" - ] - }, - { - "timezone": "Pacific SA Standard Time", - "regions": [ - "America/Santiago" - ] - }, - { - "timezone": "Newfoundland Standard Time", - "regions": [ - "America/St_Johns" - ] - }, - { - "timezone": "Tocantins Standard Time", - "regions": [ - "America/Araguaina" - ] - }, - { - "timezone": "E. South America Standard Time", - "regions": [ - "America/Sao_Paulo" - ] - }, - { - "timezone": "SA Eastern Standard Time", - "regions": [ - "America/Cayenne", - "Antarctica/Rothera", - "Antarctica/Palmer", - "America/Fortaleza", - "America/Belem", - "America/Maceio", - "America/Recife", - "America/Santarem", - "Atlantic/Stanley", - "America/Paramaribo", - "Etc/GMT+3" - ] - }, - { - "timezone": "Argentina Standard Time", - "regions": [ - "America/Buenos_Aires", - "America/Argentina/La_Rioja", - "America/Argentina/Rio_Gallegos", - "America/Argentina/Salta", - "America/Argentina/San_Juan", - "America/Argentina/San_Luis", - "America/Argentina/Tucuman", - "America/Argentina/Ushuaia", - "America/Catamarca", - "America/Cordoba", - "America/Jujuy", - "America/Mendoza" - ] - }, - { - "timezone": "Greenland Standard Time", - "regions": [ - "America/Godthab" - ] - }, - { - "timezone": "Montevideo Standard Time", - "regions": [ - "America/Montevideo" - ] - }, - { - "timezone": "Magallanes Standard Time", - "regions": [ - "America/Punta_Arenas" - ] - }, - { - "timezone": "Saint Pierre Standard Time", - "regions": [ - "America/Miquelon" - ] - }, - { - "timezone": "Bahia Standard Time", - "regions": [ - "America/Bahia" - ] - }, - { - "timezone": "UTC-02", - "regions": [ - "Etc/GMT+2", - "America/Noronha", - "Atlantic/South_Georgia" - ] - }, - { - "timezone": "Azores Standard Time", - "regions": [ - "Atlantic/Azores", - "America/Scoresbysund" - ] - }, - { - "timezone": "Cape Verde Standard Time", - "regions": [ - "Atlantic/Cape_Verde", - "Etc/GMT+1" - ] - }, - { - "timezone": "UTC", - "regions": [ - "Etc/UTC", - "Etc/GMT" - ] - }, - { - "timezone": "GMT Standard Time", - "regions": [ - "Europe/London", - "Atlantic/Canary", - "Atlantic/Faeroe", - "Europe/Guernsey", - "Europe/Dublin", - "Europe/Isle_of_Man", - "Europe/Jersey", - "Europe/Lisbon", - "Atlantic/Madeira" - ] - }, - { - "timezone": "Greenwich Standard Time", - "regions": [ - "Atlantic/Reykjavik", - "Africa/Ouagadougou", - "Africa/Abidjan", - "Africa/Accra", - "America/Danmarkshavn", - "Africa/Banjul", - "Africa/Conakry", - "Africa/Bissau", - "Africa/Monrovia", - "Africa/Bamako", - "Africa/Nouakchott", - "Atlantic/St_Helena", - "Africa/Freetown", - "Africa/Dakar", - "Africa/Lome" - ] - }, - { - "timezone": "Sao Tome Standard Time", - "regions": [ - "Africa/Sao_Tome" - ] - }, - { - "timezone": "Morocco Standard Time", - "regions": [ - "Africa/Casablanca", - "Africa/El_Aaiun" - ] - }, - { - "timezone": "W. Europe Standard Time", - "regions": [ - "Europe/Berlin", - "Europe/Andorra", - "Europe/Vienna", - "Europe/Zurich", - "Europe/Busingen", - "Europe/Gibraltar", - "Europe/Rome", - "Europe/Vaduz", - "Europe/Luxembourg", - "Europe/Monaco", - "Europe/Malta", - "Europe/Amsterdam", - "Europe/Oslo", - "Europe/Stockholm", - "Arctic/Longyearbyen", - "Europe/San_Marino", - "Europe/Vatican" - ] - }, - { - "timezone": "Central Europe Standard Time", - "regions": [ - "Europe/Budapest", - "Europe/Tirane", - "Europe/Prague", - "Europe/Podgorica", - "Europe/Belgrade", - "Europe/Ljubljana", - "Europe/Bratislava" - ] - }, - { - "timezone": "Romance Standard Time", - "regions": [ - "Europe/Paris", - "Europe/Brussels", - "Europe/Copenhagen", - "Europe/Madrid", - "Africa/Ceuta" - ] - }, - { - "timezone": "Central European Standard Time", - "regions": [ - "Europe/Warsaw", - "Europe/Sarajevo", - "Europe/Zagreb", - "Europe/Skopje" - ] - }, - { - "timezone": "W. Central Africa Standard Time", - "regions": [ - "Africa/Lagos", - "Africa/Luanda", - "Africa/Porto-Novo", - "Africa/Kinshasa", - "Africa/Bangui", - "Africa/Brazzaville", - "Africa/Douala", - "Africa/Algiers", - "Africa/Libreville", - "Africa/Malabo", - "Africa/Niamey", - "Africa/Ndjamena", - "Africa/Tunis", - "Etc/GMT-1" - ] - }, - { - "timezone": "Jordan Standard Time", - "regions": [ - "Asia/Amman" - ] - }, - { - "timezone": "GTB Standard Time", - "regions": [ - "Europe/Bucharest", - "Asia/Nicosia", - "Asia/Famagusta", - "Europe/Athens" - ] - }, - { - "timezone": "Middle East Standard Time", - "regions": [ - "Asia/Beirut" - ] - }, - { - "timezone": "Egypt Standard Time", - "regions": [ - "Africa/Cairo" - ] - }, - { - "timezone": "E. Europe Standard Time", - "regions": [ - "Europe/Chisinau" - ] - }, - { - "timezone": "Syria Standard Time", - "regions": [ - "Asia/Damascus" - ] - }, - { - "timezone": "West Bank Standard Time", - "regions": [ - "Asia/Hebron", - "Asia/Gaza" - ] - }, - { - "timezone": "South Africa Standard Time", - "regions": [ - "Africa/Johannesburg", - "Africa/Bujumbura", - "Africa/Gaborone", - "Africa/Lubumbashi", - "Africa/Maseru", - "Africa/Blantyre", - "Africa/Maputo", - "Africa/Kigali", - "Africa/Mbabane", - "Africa/Lusaka", - "Africa/Harare", - "Etc/GMT-2" - ] - }, - { - "timezone": "FLE Standard Time", - "regions": [ - "Europe/Kiev", - "Europe/Mariehamn", - "Europe/Sofia", - "Europe/Tallinn", - "Europe/Helsinki", - "Europe/Vilnius", - "Europe/Riga", - "Europe/Uzhgorod", - "Europe/Zaporozhye" - ] - }, - { - "timezone": "Israel Standard Time", - "regions": [ - "Asia/Jerusalem" - ] - }, - { - "timezone": "South Sudan Standard Time", - "regions": [ - "Africa/Juba" - ] - }, - { - "timezone": "Kaliningrad Standard Time", - "regions": [ - "Europe/Kaliningrad" - ] - }, - { - "timezone": "Sudan Standard Time", - "regions": [ - "Africa/Khartoum" - ] - }, - { - "timezone": "Libya Standard Time", - "regions": [ - "Africa/Tripoli" - ] - }, - { - "timezone": "Namibia Standard Time", - "regions": [ - "Africa/Windhoek" - ] - }, - { - "timezone": "Arabic Standard Time", - "regions": [ - "Asia/Baghdad" - ] - }, - { - "timezone": "Turkey Standard Time", - "regions": [ - "Europe/Istanbul" - ] - }, - { - "timezone": "Arab Standard Time", - "regions": [ - "Asia/Riyadh", - "Asia/Bahrain", - "Asia/Kuwait", - "Asia/Qatar", - "Asia/Aden" - ] - }, - { - "timezone": "Belarus Standard Time", - "regions": [ - "Europe/Minsk" - ] - }, - { - "timezone": "Russian Standard Time", - "regions": [ - "Europe/Moscow", - "Europe/Kirov", - "Europe/Simferopol" - ] - }, - { - "timezone": "E. Africa Standard Time", - "regions": [ - "Africa/Nairobi", - "Antarctica/Syowa", - "Africa/Djibouti", - "Africa/Asmera", - "Africa/Addis_Ababa", - "Indian/Comoro", - "Indian/Antananarivo", - "Africa/Mogadishu", - "Africa/Dar_es_Salaam", - "Africa/Kampala", - "Indian/Mayotte", - "Etc/GMT-3" - ] - }, - { - "timezone": "Iran Standard Time", - "regions": [ - "Asia/Tehran" - ] - }, - { - "timezone": "Arabian Standard Time", - "regions": [ - "Asia/Dubai", - "Asia/Muscat", - "Etc/GMT-4" - ] - }, - { - "timezone": "Astrakhan Standard Time", - "regions": [ - "Europe/Astrakhan", - "Europe/Ulyanovsk" - ] - }, - { - "timezone": "Azerbaijan Standard Time", - "regions": [ - "Asia/Baku" - ] - }, - { - "timezone": "Russia Time Zone 3", - "regions": [ - "Europe/Samara" - ] - }, - { - "timezone": "Mauritius Standard Time", - "regions": [ - "Indian/Mauritius", - "Indian/Reunion", - "Indian/Mahe" - ] - }, - { - "timezone": "Saratov Standard Time", - "regions": [ - "Europe/Saratov" - ] - }, - { - "timezone": "Georgian Standard Time", - "regions": [ - "Asia/Tbilisi" - ] - }, - { - "timezone": "Volgograd Standard Time", - "regions": [ - "Europe/Volgograd" - ] - }, - { - "timezone": "Caucasus Standard Time", - "regions": [ - "Asia/Yerevan" - ] - }, - { - "timezone": "Afghanistan Standard Time", - "regions": [ - "Asia/Kabul" - ] - }, - { - "timezone": "West Asia Standard Time", - "regions": [ - "Asia/Tashkent", - "Antarctica/Mawson", - "Asia/Oral", - "Asia/Aqtau", - "Asia/Aqtobe", - "Asia/Atyrau", - "Indian/Maldives", - "Indian/Kerguelen", - "Asia/Dushanbe", - "Asia/Ashgabat", - "Asia/Samarkand", - "Etc/GMT-5" - ] - }, - { - "timezone": "Ekaterinburg Standard Time", - "regions": [ - "Asia/Yekaterinburg" - ] - }, - { - "timezone": "Pakistan Standard Time", - "regions": [ - "Asia/Karachi" - ] - }, - { - "timezone": "Qyzylorda Standard Time", - "regions": [ - "Asia/Qyzylorda" - ] - }, - { - "timezone": "India Standard Time", - "regions": [ - "Asia/Calcutta" - ] - }, - { - "timezone": "Sri Lanka Standard Time", - "regions": [ - "Asia/Colombo" - ] - }, - { - "timezone": "Nepal Standard Time", - "regions": [ - "Asia/Katmandu" - ] - }, - { - "timezone": "Central Asia Standard Time", - "regions": [ - "Asia/Almaty", - "Antarctica/Vostok", - "Asia/Urumqi", - "Indian/Chagos", - "Asia/Bishkek", - "Asia/Qostanay", - "Etc/GMT-6" - ] - }, - { - "timezone": "Bangladesh Standard Time", - "regions": [ - "Asia/Dhaka", - "Asia/Thimphu" - ] - }, - { - "timezone": "Omsk Standard Time", - "regions": [ - "Asia/Omsk" - ] - }, - { - "timezone": "Myanmar Standard Time", - "regions": [ - "Asia/Rangoon", - "Indian/Cocos" - ] - }, - { - "timezone": "SE Asia Standard Time", - "regions": [ - "Asia/Bangkok", - "Antarctica/Davis", - "Indian/Christmas", - "Asia/Jakarta", - "Asia/Pontianak", - "Asia/Phnom_Penh", - "Asia/Vientiane", - "Asia/Saigon", - "Etc/GMT-7" - ] - }, - { - "timezone": "Altai Standard Time", - "regions": [ - "Asia/Barnaul" - ] - }, - { - "timezone": "W. Mongolia Standard Time", - "regions": [ - "Asia/Hovd" - ] - }, - { - "timezone": "North Asia Standard Time", - "regions": [ - "Asia/Krasnoyarsk", - "Asia/Novokuznetsk" - ] - }, - { - "timezone": "N. Central Asia Standard Time", - "regions": [ - "Asia/Novosibirsk" - ] - }, - { - "timezone": "Tomsk Standard Time", - "regions": [ - "Asia/Tomsk" - ] - }, - { - "timezone": "China Standard Time", - "regions": [ - "Asia/Shanghai", - "Asia/Hong_Kong", - "Asia/Macau" - ] - }, - { - "timezone": "North Asia East Standard Time", - "regions": [ - "Asia/Irkutsk" - ] - }, - { - "timezone": "Singapore Standard Time", - "regions": [ - "Asia/Singapore", - "Asia/Brunei", - "Asia/Makassar", - "Asia/Kuala_Lumpur", - "Asia/Kuching", - "Asia/Manila", - "Etc/GMT-8" - ] - }, - { - "timezone": "W. Australia Standard Time", - "regions": [ - "Australia/Perth" - ] - }, - { - "timezone": "Taipei Standard Time", - "regions": [ - "Asia/Taipei" - ] - }, - { - "timezone": "Ulaanbaatar Standard Time", - "regions": [ - "Asia/Ulaanbaatar", - "Asia/Choibalsan" - ] - }, - { - "timezone": "Aus Central W. Standard Time", - "regions": [ - "Australia/Eucla" - ] - }, - { - "timezone": "Transbaikal Standard Time", - "regions": [ - "Asia/Chita" - ] - }, - { - "timezone": "Tokyo Standard Time", - "regions": [ - "Asia/Tokyo", - "Asia/Jayapura", - "Pacific/Palau", - "Asia/Dili", - "Etc/GMT-9" - ] - }, - { - "timezone": "North Korea Standard Time", - "regions": [ - "Asia/Pyongyang" - ] - }, - { - "timezone": "Korea Standard Time", - "regions": [ - "Asia/Seoul" - ] - }, - { - "timezone": "Yakutsk Standard Time", - "regions": [ - "Asia/Yakutsk", - "Asia/Khandyga" - ] - }, - { - "timezone": "Cen. Australia Standard Time", - "regions": [ - "Australia/Adelaide", - "Australia/Broken_Hill" - ] - }, - { - "timezone": "AUS Central Standard Time", - "regions": [ - "Australia/Darwin" - ] - }, - { - "timezone": "E. Australia Standard Time", - "regions": [ - "Australia/Brisbane", - "Australia/Lindeman" - ] - }, - { - "timezone": "AUS Eastern Standard Time", - "regions": [ - "Australia/Sydney", - "Australia/Melbourne" - ] - }, - { - "timezone": "West Pacific Standard Time", - "regions": [ - "Pacific/Port_Moresby", - "Antarctica/DumontDUrville", - "Pacific/Truk", - "Pacific/Guam", - "Pacific/Saipan", - "Etc/GMT-10" - ] - }, - { - "timezone": "Tasmania Standard Time", - "regions": [ - "Australia/Hobart", - "Australia/Currie", - "Antarctica/Macquarie" - ] - }, - { - "timezone": "Vladivostok Standard Time", - "regions": [ - "Asia/Vladivostok", - "Asia/Ust-Nera" - ] - }, - { - "timezone": "Lord Howe Standard Time", - "regions": [ - "Australia/Lord_Howe" - ] - }, - { - "timezone": "Bougainville Standard Time", - "regions": [ - "Pacific/Bougainville" - ] - }, - { - "timezone": "Russia Time Zone 10", - "regions": [ - "Asia/Srednekolymsk" - ] - }, - { - "timezone": "Magadan Standard Time", - "regions": [ - "Asia/Magadan" - ] - }, - { - "timezone": "Norfolk Standard Time", - "regions": [ - "Pacific/Norfolk" - ] - }, - { - "timezone": "Sakhalin Standard Time", - "regions": [ - "Asia/Sakhalin" - ] - }, - { - "timezone": "Central Pacific Standard Time", - "regions": [ - "Pacific/Guadalcanal", - "Antarctica/Casey", - "Pacific/Ponape", - "Pacific/Kosrae", - "Pacific/Noumea", - "Pacific/Efate", - "Etc/GMT-11" - ] - }, - { - "timezone": "Russia Time Zone 11", - "regions": [ - "Asia/Kamchatka", - "Asia/Anadyr" - ] - }, - { - "timezone": "New Zealand Standard Time", - "regions": [ - "Pacific/Auckland", - "Antarctica/McMurdo" - ] - }, - { - "timezone": "UTC+12", - "regions": [ - "Etc/GMT-12", - "Pacific/Tarawa", - "Pacific/Majuro", - "Pacific/Kwajalein", - "Pacific/Nauru", - "Pacific/Funafuti", - "Pacific/Wake", - "Pacific/Wallis" - ] - }, - { - "timezone": "Fiji Standard Time", - "regions": [ - "Pacific/Fiji" - ] - }, - { - "timezone": "Chatham Islands Standard Time", - "regions": [ - "Pacific/Chatham" - ] - }, - { - "timezone": "UTC+13", - "regions": [ - "Etc/GMT-13", - "Pacific/Enderbury", - "Pacific/Fakaofo" - ] - }, - { - "timezone": "Tonga Standard Time", - "regions": [ - "Pacific/Tongatapu" - ] - }, - { - "timezone": "Samoa Standard Time", - "regions": [ - "Pacific/Apia" - ] - }, - { - "timezone": "Line Islands Standard Time", - "regions": [ - "Pacific/Kiritimati", - "Etc/GMT-14" - ] - } -] diff --git a/Projects/Server/TimeZones/TimeZoneHandler.cs b/Projects/Server/TimeZones/TimeZoneHandler.cs index 5c3bb80bff..6872deac4f 100644 --- a/Projects/Server/TimeZones/TimeZoneHandler.cs +++ b/Projects/Server/TimeZones/TimeZoneHandler.cs @@ -1,6 +1,6 @@ /************************************************************************* * ModernUO * - * Copyright 2019-2022 - ModernUO Development Team * + * Copyright 2019-2023 - ModernUO Development Team * * Email: hi@modernuo.com * * File: TimeZoneHandler.cs * * * @@ -14,74 +14,22 @@ *************************************************************************/ using System; -using System.Collections.Generic; -using System.IO; using System.Runtime.CompilerServices; -using Server.Json; -using Server.Logging; namespace Server; -/** - * TimeZoneHandler provides a cross platform compatible way to handle system timezones. - * - * By default the system timezone is used. - * To manually configure the local timezone add the following setting to modernuo.json: - * "system.localTimeZone": "Pacific Standard Time" - * All valid timezones can be found in the Distribution/Data/timezones.json file. - * - * Notes for timezones.json: - * By default, Windows will use the values in the "timezone" property. - * By default, Unix/MacOS will use the values in the "region" property. - * system.localTimeZone can be either timezone or a region. - * - * Example: - * "system.localTimeZone": "Europe/Lisbon" - */ public static class TimeZoneHandler { - private static readonly ILogger logger = LogFactory.GetLogger(typeof(TimeZoneHandler)); - - private static readonly Dictionary _timeZoneById = new(); public static TimeZoneInfo SystemTimeZone { get; private set; } - static TimeZoneHandler() - { - var timezones = JsonConfig.Deserialize(Path.Combine(Core.BaseDirectory, "Data/timezones.json")); - foreach (var tz in timezones) - { - try - { - // Get the timezone if we are on Windows - var tzInfo = Core.IsWindows ? TimeZoneInfo.FindSystemTimeZoneById(tz.TimeZone) : null; - - foreach (var region in tz.Regions) - { - // Get the timezone by region if we are on linux - tzInfo ??= TimeZoneInfo.FindSystemTimeZoneById(region); - _timeZoneById[region] = tzInfo; - } - - _timeZoneById[tz.TimeZone] = tzInfo; - } - catch (TimeZoneNotFoundException e) - { - logger.Warning(e, $"Timezone '{tz.TimeZone}' was not found."); - } - } - } - public static void Configure() { var tzId = ServerConfiguration.GetSetting("system.localTimeZone", TimeZoneInfo.Local.Id); SystemTimeZone = FindTimeZoneById(tzId); } - /** - * Cross platform version of TimeZoneInfo.FindSystemTimeZoneById - */ [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static TimeZoneInfo FindTimeZoneById(string id) => _timeZoneById[id]; + public static TimeZoneInfo FindTimeZoneById(string id) => TimeZoneInfo.FindSystemTimeZoneById(id); [MethodImpl(MethodImplOptions.AggressiveInlining)] public static DateTime ToSystemLocalTime(this DateTime date) => diff --git a/README.md b/README.md index 480e4d61e4..998cb819bc 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ ModernUO [![Discord](https://img.shields.io/discord/751317910504603701?logo=disc ## Requirements #### Supported Operating Systems -[![Windows 10/11/2016/2019/2022](https://img.shields.io/badge/-server%202022-0078D6?logo=windows&logoColor=0078D6&labelColor=222222)](https://www.microsoft.com/en-US/evalcenter/evaluate-windows-server-2022) +[![Windows 10/11/2019/2022](https://img.shields.io/badge/-server%202022-0078D6?logo=windows&logoColor=0078D6&labelColor=222222)](https://www.microsoft.com/en-US/evalcenter/evaluate-windows-server-2022) ![MacOS 10.15+](https://img.shields.io/badge/-ventura-222222?logo=apple&logoColor=white&labelColor=222222) [![Debian 10+](https://img.shields.io/badge/-bullseye-A81D33?logo=debian&logoColor=A81D33&labelColor=222222)](https://www.debian.org/distrib/) [![Ubuntu 16+ LTS](https://img.shields.io/badge/-22LTS-E95420?logo=ubuntu&logoColor=E95420&labelColor=222222)](https://ubuntu.com/download/server) @@ -30,11 +30,11 @@ ModernUO [![Discord](https://img.shields.io/discord/751317910504603701?logo=disc [![Arch](https://img.shields.io/badge/-Arch-1793D1?logo=archlinux&logoColor=1793D1&labelColor=222222)](https://archlinux.org/download/) #### Running the server -[![.NET](https://img.shields.io/badge/-7.0.3-5C2D91?logo=.NET&logoColor=white&labelColor=222222)](https://dotnet.microsoft.com/download/dotnet/7.0) +[![.NET](https://img.shields.io/badge/-7.0.4-5C2D91?logo=.NET&logoColor=white&labelColor=222222)](https://dotnet.microsoft.com/download/dotnet/7.0) #### Development [![git](https://img.shields.io/badge/-git-F05032?logo=git&logoColor=F05032&labelColor=222222)](https://git-scm.com/downloads) -[![.NET](https://img.shields.io/badge/-%207.0.201%20SDK-5C2D91?logo=.NET&logoColor=white&labelColor=222222)](https://dotnet.microsoft.com/download/dotnet/7.0) +[![.NET](https://img.shields.io/badge/-%207.0.202%20SDK-5C2D91?logo=.NET&logoColor=white&labelColor=222222)](https://dotnet.microsoft.com/download/dotnet/7.0) #### Supported IDEs @@ -57,8 +57,8 @@ ModernUO [![Discord](https://img.shields.io/discord/751317910504603701?logo=disc ## Building/Publishing - Run `./publish.cmd [release|debug (default: release)] [os] [arch (default: x64)]` - `os` - [Supported operating systems](https://github.com/dotnet/core/blob/main/release-notes/7.0/supported-os.md) - - `win` - Windows 10/11/2016/2019/2022 - - `osx` - MacOS 10.15/11/12/13 (Catalina, Big Sur, Monterey, Ventura) + - `win` - Windows 10/11/2019/2022 + - `osx` - MacOS 11/12/13 (Big Sur, Monterey, Ventura) - `linux` - Linux - `arch` - `x64` - Intel 64-bit @@ -83,7 +83,7 @@ apt-get install -y libicu-dev libz-dev zstd libargon2-dev tzdata ## Running the Server - Follow the [publish](https://github.com/modernuo/ModernUO#publishing-builds) instructions -- Run `ModernUO.exe` or `dotnet ModernUO.dll` from the `Distribution` directory on the server +- Run `ModernUO.exe` or `dotnet ModernUO.dll` from the `Distribution` directory on the ## Troubleshooting / FAQ - See [FAQ](./FAQ.md)