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

Should TimeZoneInfo::LocalTime be an absolute time? #6238

Open
sffc opened this issue Mar 6, 2025 · 4 comments
Open

Should TimeZoneInfo::LocalTime be an absolute time? #6238

sffc opened this issue Mar 6, 2025 · 4 comments
Labels
2.0-breaking Changes that are breaking API changes C-time-zone Component: Time Zones

Comments

@sffc
Copy link
Member

sffc commented Mar 6, 2025

It seems there would be problems near a transition to determine what metazone to use.

It looks like some of our data is already in UTC offsets. For example:

    "globy": {
      "1981-03-29 02:00": 62,
      "2024-03-31 01:00": 63
    },

From what I can tell, the metazone changed on 2024-03-31 at 00:00 local time, which was 01:00 UTC. (It changed from -0100 East Greenland Standard Time to -0100 [West] Greenland Summer Time, so the metazone changed, but not the offset.)

CC @robertbastian

@sffc sffc added C-time-zone Component: Time Zones needs-approval One or more stakeholders need to approve proposal labels Mar 6, 2025
@sffc sffc added this to the ICU4X 2.0 ⟨P1⟩ milestone Mar 6, 2025
@robertbastian
Copy link
Member

Metazone periods are also in local time, which is why I made offset periods use local time. We made the decision that all our APIs accept local time, in order to support inputs like 2024-09-12T02:00:00[Europe/Zurich] without bundling a TZDB.

The data might be buggy, but it is intended to be in local time.

@robertbastian
Copy link
Member

Oh these are metazone periods. Well, good thing I made them human readable, we can debug now.

@robertbastian
Copy link
Member

From what I can tell, the metazone changed on 2024-03-31 at 00:00 local time

And what did you tell that from? metaZones.xml disagrees (those are local times):

<timezone type="America/Scoresbysund">
	<usesMetazone to="1981-03-29 02:00" mzone="Greenland_Central"/>
	<usesMetazone to="2024-03-31 01:00" from="1981-03-29 02:00" mzone="Greenland_Eastern"/>
	<usesMetazone from="2024-03-31 01:00" mzone="Greenland"/>
</timezone>

@sffc
Copy link
Member Author

sffc commented Mar 6, 2025

  • @robertbastian Often we don't have the offset/absolute time. You need this for generic zone mapping, too, not just specific zone mapping.
  • @sffc Maybe it can encode the time as a local time with offset. We'd need to change the serialized data type which is currently "minutes since local epoch".
  • @robertbastian Looking at metazones.xml, America/Louisville changes at 0700, so it is probably in UTC, unlike we assumed. But it seems easy enough to change this in datagen.

Conclusion: OK to make this 2.0-stretch

@sffc sffc removed the needs-approval One or more stakeholders need to approve proposal label Mar 6, 2025
@sffc sffc added the 2.0-breaking Changes that are breaking API changes label Mar 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2.0-breaking Changes that are breaking API changes C-time-zone Component: Time Zones
Projects
None yet
Development

No branches or pull requests

2 participants