I am writing an app that asks the user to choose a time zone. I am getting my list of time zones from the Olson database (via NodaTime) but that is a massive list with many redundant entries, for my purposes at least.
When you create an event on Google Calendar it lets you choose the time zone from a relatively small list with ordering by country where necessary. I would like to be able to achieve something as simple as that without creating a separate database, which is what
this person does.
Because I am writing this in C# MVC plus JavaScript on the front end, I am looking for a library in either of those languages that gives me a reduced list in a user-friendly format that I could display in a dropdown. Is there such a thing or do I have to create my own and regularly keep it up to date, like the example shown in the hyperlink?
Two possible answers here:
Information from the
zone.tabfile. As it happens, just today another contributor mailed the list with an hg clone which uses this data. I haven’t looked at it yet, but hope to do so over the weekend – and after a bit of massaging, we’ll hopefully get it into the 1.1 branch.Information from CLDR. This provides suggested example cities to present to a user – it’s designed for exactly this purpose (even localized, I believe). However, you’d need to integrate this with Noda Time yourself; we don’t currently have any code for this, and just getting to grips with CLDR will take some time.
Apologies for this not being solved out of the box – but we’re aware of it and hope to provide an answer over time.