mattjohnsonpint / TimeZoneNames

Provides a complete source of localized time zone names and abbreviations.
MIT License
196 stars 32 forks source link

Use System.Text.Json instead of Newtonsoft #85

Closed josephxxv closed 1 year ago

josephxxv commented 1 year ago

This PR addressed issue #76.

Removed Newtonsoft.Json references and replaced them with System.Text.Json references. I had to add setters to the properties on the serialized data objects because System.Text.Json doesn't support serializing/deserializing readonly properties. System.Text.Json also doesn't respect the property initializers in the class, and instead always invokes the setter on the property. To address this, a new converter was needed to properly create a Dictionary<string, TValue> that uses the StringComparison.OrdinalIgnoreCase key comparer.

All unit tests passed locally except for Can_Get_DisplayNames_For_OS_Culture due to my system still having Volograd Standard Time set to UTC+3:00:

Volgograd Standard Time = "(UTC+04:00) Volgograd" expected "(UTC+03:00) Volgograd"

mattjohnsonpint commented 1 year ago

Thanks so much for this!

All unit tests passed locally except for Can_Get_DisplayNames_For_OS_Culture due to my system still having Volograd Standard Time set to UTC+3:00

Yes, I have a fix for that and several other changes coming soon.