Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Czechia and Slovakia timezone mixup #1066

Open
nexpid opened this issue May 27, 2023 · 1 comment
Open

Czechia and Slovakia timezone mixup #1066

nexpid opened this issue May 27, 2023 · 1 comment

Comments

@nexpid
Copy link

nexpid commented May 27, 2023

Environment

in data/packed/latest.json, timezones Europe/Prague and Europe/Bratislava are marked as the same timezone:

"Europe/Prague|Europe/Bratislava",

country code SK includes Europe/Prague (incorrect) and Europe/Bratislava (correct):

"SK|Europe/Prague Europe/Bratislava",

Issue description

As mentioned above, country code SK also includes Europe/Prague, even though Prague is in Czechia, not Slovakia.
image

Running this code in the latest version of moment-timezone also yields wrong results:

moment.tz.zonesForCountry("CZ"); // => [ "Europe/Prague" ] (✅)

moment.tz.zonesForCountry("SK"); // => [ "Europe/Bratislava", "Europe/Prague" ] (❌)
@gilmoreorless
Copy link
Member

This is a similar issue to #1005, and I'll tweak my comment from there.

The data comes from the IANA time zone database (tzdb). There have been some changes with recent releases of tzdb, where time zones that have the same data since 1970 have been merged together, even if they're in different countries. This has definitely caused some confusion here and in other software projects.

The important thing is that identifiers like Europe/Prague are labels for regions of the world where the clocks agree. The country data you've quoted is not saying that Prague is in Slovakia. It's saying that the time in Slovakia can be represented by a time zone that happens to have the label Europe/Prague.

This can be seen in the tzdb source zone1970.tab:

CZ,SK +5005+01426 Europe/Prague

That line says that Czechia and Slovakia can both be represented by the same time zone rules. This would be equally true if the labels didn't have city names at all, but instead were named something like Europe/Zone073.

Note that Europe/Bratislava doesn't appear in that zone1970.tab file, because it's just a backwards-compatibility link to Europe/Prague. Moment Timezone adds the compatibility links to the country lists as well, based on the older (and deprecated) zone.tab.

I know this is a confusing situation. I'm going to leave this issue open as a reminder to write some proper documentation about it on the momentjs.com site.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants