You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In general, it seems that zonesForCountry does not return "link" records of the IANA database. A link record, as far as I understand, is a record that itself does not have an offset, but is tied to the offset of another timezone. In the case of "Australia/Canberra" that other timezone is "Australia/Sydney".
The text was updated successfully, but these errors were encountered:
You're correct that it doesn't return zone links, only primary zone records. This is because the list is generated by parsing the tzdb's zone.tab and zone1970.tab files. These source files don't list any links, because the point of the files is to list only the active, primary zones for a region.
Links are not primary zones, they're just aliases. Sometimes the aliases are because there used to be a primary zone of that name, but it's been merged into another zone. Sometimes it's a simple rename (one of the most recent was Europe/Kiev to Europe/Kyiv). But either way, the links are mostly there just for backwards compatibility.
Out of curiosity, why do you want Australia/Canberra to be in the list, when it's been an alias of Australia/Sydney for a long time?
Because we have a dropdown of timezones for Australia. One of our clients passed "Australia/Canberra", and because it wasn't in the dropdown, it caused issues. I am just going to obtain the list of timezones for Australia from another source (hardcoded list)
Environment:
Moment Version: 2.30.1
Moment Timezone Version: 0.5.45-2024a
System: https://momentjs.com/ developer console
console.log(moment.tz.zonesForCountry("AU"));
This is supposed to return all timezones for Australia, but it's missing some. For example "Australia/Canberra".
This is what it returns:
['Antarctica/Macquarie', 'Australia/Adelaide', 'Australia/Brisbane', 'Australia/Broken_Hill', 'Australia/Darwin', 'Australia/Eucla', 'Australia/Hobart', 'Australia/Lindeman', 'Australia/Lord_Howe', 'Australia/Melbourne', 'Australia/Perth', 'Australia/Sydney']
But where's "Australia/Canberra"?
In general, it seems that zonesForCountry does not return "link" records of the IANA database. A link record, as far as I understand, is a record that itself does not have an offset, but is tied to the offset of another timezone. In the case of "Australia/Canberra" that other timezone is "Australia/Sydney".
The text was updated successfully, but these errors were encountered: