jcfranco / timezone-groups

A small script to iterate over a list of timezones and auto-groups them based on similarity.
MIT License
0 stars 0 forks source link

Add support for time zone aliases #1

Open jcfranco opened 6 months ago

jcfranco commented 6 months ago

According to https://en.wikipedia.org/wiki/List_of_tz_database_time_zones, time zones can be referenced by an alias (link time zone). The grouping logic should provide a way to define aliases, so they can be included in tzs (both link and canonical time zones), but ignored when generating labelTzIndices (canonical only).

For example, when running Intl.supportedValuesOf("timeZone"), Chrome's result includes Asia/Katmandu, whereas Firefox's includes Asia/Kathmandu.

richiecarmichael commented 6 months ago

More importantly the ECMA specification states that a time zone identifier as used in various Intl methods can be one of the following:

  1. A primary time zone identifier (same as a canonical IANA time zone),
  2. A non-primary time zone identifier (same as a link IANA time zone), or
  3. An offset time zone (e.g. +hh:mm) (see here)

Reading (3) is new to me. This is good to know but hopefully never used.

The following statement also confirms that both canonical and link IANA time zones are acceptable inputs in ECMA script.

A conforming implementation must recognize "UTC" and all Zone and Link names from the IANA Time Zone Database... (from here)

In the cases where a user specifies a link IANA time zone, should it be mapped to zoned/canonical time zone?

jcfranco commented 6 months ago

@richiecarmichael Thanks for sharing the spec! I'll update the description to use proper terminology.

I was thinking groups would need to include both canonical and link time zones, but only use canonical for labeling.

In the cases where a user specifies a link IANA time zone, should it be mapped to zoned/canonical time zone?

I'm not sure I follow. Users don't specify time zones when using timezone-groups.

richiecarmichael commented 6 months ago

I mean, if a user specifies a linked time zone, do we automatically return or show the corresponding canonical/zoned time zone?

// A user specifies a linked time zone
const view = new MapView({ timeZone: "Antarctica/South_Pole" });

// Perhaps always write the canonical/zoned equivalent
console.log(view.write({})); // { timeZone: "Pacific/Auckland" }

Similarly if a user set the value to "Antarctica/South_Pole"...

<calcite-input-time-zone mode="name" value="Antarctica/South_Pole"></calcite-input-time-zone>

...should we show Auckland in the UI? image

btw. I don't know the answer to these. 😄

jcfranco commented 6 months ago

I think this discussion is better suited for https://github.com/Esri/calcite-design-system/, but to answer your question, I think the component should map the linked time zone to a canonical one.

BTW, I also don't know the answer to these. 😅