Open caseyjhol opened 2 years ago
I agree this is a slightly confusing scenario. (I even had to go and double-check my own code just to make sure I properly understood what was happening.)
First, here's why the plugin (currently) doesn't include US/Eastern
:
matchZones
option will include only zones that match the provided value(s). If a zone is defined in moment-timezone
as a link, then the zone it points to is also included. So asking for US/Eastern
will also include America/New_York
, but not the other way around. This was done because some zones have many, many links (e.g. America/Puerto_Rico
has 20 links pointing to it).matchCountries
option chooses which zones are included based on the countries
data provided by moment-timezone
. For US
, this is 29 zones.
zone.tab
and zone1970.tab
files in the IANA time zone database. US/Eastern
doesn't appear in any of those lists, mainly because it's using an old, long-deprecated naming format that the tzdb maintainers would like people to move away from.matchZones
, there is some link handling here, but only if the links are found in that primary countries
list.I'll have a think about adding an option to include all links that point to the defined zones. It would probably be useful for other use cases too. In the meantime I think adding the extra ^US/
matcher like you have is the best workaround.
I've also created #55 to add more documentation about how zones are included.
The "America/New_York" time zone has a "US/Eastern" link.
However, when using:
or
"US/Eastern" does not show up in
moment.tz.names()
. I see there is some existing code that appears to handle links, but it apparently doesn't do what I was expecting. Some links are included, it seems, but others are not.It would be great if there was an option to include linked time zones as well. I'm working around this for now by including
/^US\//
in matchZones, but it's not a perfect solution.