How do I get a list of "time zones" from NodaTime such that I can make a UI like the below for my users to choose from?
I want to show the UTC offset and then the appropriate cities/countries/locations. It doesn't need to be exactly like the below, but you know, something close.
DateTimeZone
doesn't have a name property, and ToString()
ing produces duplicates (from the list of Ids
from IDateTimeZoneProvider
).
I see you can go from ~countries to zones, with TzdbDateTimeZoneSource.Default.ZoneLocations
, but thats also not exactly what I'm looking for. I can see how I can cobble these two data sources together, but this feels like a solved problem I shouldn't be reinventing.
Noda Time doesn't currently provide user-oriented strings for time zones, no.
The best source of data for that is CLDR. We have a long-standing issue for this, but unfortunately it's fundamentally tricky. At some point I'd like to get back to it, but I haven't found time yet :(
You can use the Onism.Cldr project to access CLDR data. You'll need to understand how the CLDR data works in two respects though:
Apologies that the answer at the moment is really just "No, there's nothing out of the box" - but that's the reality :(