[tz] Timezone selectors (was RES: Timezone for Brazil)

Doug Ewell doug at ewellic.org
Tue Oct 10 22:48:05 UTC 2023

Guy Harris wrote:

> Are they being requested to select their *own* timezone or to select
> some *other* timezone?

Usually their own, but not necessarily; some of the devices could be in a satellite facility, located anywhere.

> If it's their own timezone, can your application query the system to
> determine it?

It’s a cloud-based app; the location of the server (and hence its time zone) is quite irrelevant.

> Most users should never be exposed to the existence of
> "America/Detroit" or "America/New_York" or "America/Sao_Paolo" or
> "America/Noronha" or "Asia/Shanghai" or "Europe/Berlin" or....

As I know I said at least twice, the app does not display raw tzids, but instead strings returned by CLDR (actually ICU, and with a UTC base offset prepended as requested by marketing):

(UTC-05:00) Eastern Time (Detroit)
(UTC-05:00) Eastern Time (New York)
(UTC-03:00) Brasilia Standard Time (Sao Paulo)

Brasilia “Standard” Time is not ideal, but it’s what ICU gives us, and a lot better than the raw ID or, far worse, “UTC–03:00”. (The latter is probably what we would have gotten if I had not happened to spot a proposed, oversimplified solution and interceded.)

> But presumably the list of cities is *not* just the list of cities
> used as LOCATIONs in tzdb IDs, so they can choose a city that's
> *neither* Detroit *nor* New York.

What I really would have liked to do was use the data in geonames.org, which lists essentially every location on the planet along with its tzid. The list is probably not perfect (I remember a thread some time ago about Ontario) but its maintainers appear responsive to bug reports.

Unfortunately, however, a simpler-to-implement solution was required for this project.

> (In macOS, I can choose the city in which I live, although, alas, I
> can't choose Weed.)

Weed, geonameid 5573449, is very much available in the GeoNames database, including its ‘cities1000’ data which includes only populated places (not other geographic features) that either have a population of 1,000 or greater or are an administrative seat.

Doug Ewell, CC, ALB | Lakewood, CO, US | ewellic.org

More information about the tz mailing list