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

Calculate TimeZoneInput from timestamps #533

Open
sffc opened this issue Mar 5, 2021 · 8 comments
Open

Calculate TimeZoneInput from timestamps #533

sffc opened this issue Mar 5, 2021 · 8 comments
Labels
C-time-zone Component: Time Zones discuss Discuss at a future ICU4X-SC meeting S-large Size: A few weeks (larger feature, major refactoring) T-core Type: Required functionality U-fuchsia User: Fuchsia

Comments

@sffc
Copy link
Member

sffc commented Mar 5, 2021

Pending #528, we will likely require time zones to be fully resolved into GMT offsets and metazones. However, the reality is that people will want to hand ICU4X a timestamp, and get a localized result out the other end. Our organization has the expertise to implement these conversions, and I think we should release libraries to perform them. Of course, they should be modular and stand to the side of ICU4X.

What we should implement is, I think, rather straightforward:

* I would like to take the BCP-47 time zone identifier as input because I want to encourage the use of the small, fixed-width, lightweight types within ICU4X. However, since most people will be using IANA identifiers, we should also provide a library on the side that can convert from IANA identifier to BCP-47 identifier.

We should also think about how this relates to the ISO-8601 and Temporal data models. In particular, we may want to match our data model to strings such as:

  1. 2021-03-05T07:49:02Z is a timestamp in UTC
  2. 2021-03-05T00:49:02-0700 is the same timestamp but with a GMT offset
  3. 2021-03-05T00:49:02-0700[America/Denver] is a zoned datetime; the GMT offset should serve as a hint to help resolve potential conflicts near variant transitions (daylight savings time)

In the end, we also need the ISO date to feed into #534, so the time zone resolution layer should make sure to retain that information when possible.

@sffc sffc added T-core Type: Required functionality discuss Discuss at a future ICU4X-SC meeting C-datetime Component: datetime, calendars, time zones labels Mar 5, 2021
@sffc sffc changed the title Implement timezone conversion Implement timestamp-to-timezone resolution Mar 5, 2021
@sffc
Copy link
Member Author

sffc commented Mar 12, 2021

Discussion 2021-03-12:

  • This component will need DataProvider and is unlikely to be useful outside the context of ICU4X
  • We will release this as an ICU4X utility, living in the ICU4X repo
  • This component is more closely tied to ICU4X than, say, TinyStr, so we shouldn't tie this conclusion to conclusions about TinyStr

@sffc sffc removed the discuss Discuss at a future ICU4X-SC meeting label Mar 12, 2021
@sffc sffc added this to the 2021-Q2-m1 milestone Mar 12, 2021
@sffc sffc changed the title Implement timestamp-to-timezone resolution Implement time zone calculations Mar 16, 2021
@sffc
Copy link
Member Author

sffc commented Mar 16, 2021

I think we should seriously consider making a TimeZone class with a similar API as Temporal.TimeZone, which has two benefits:

  1. We can follow a pre-existing design
  2. Helps ICU4X be a basis for Temporal implementations

Read more: https://github.com/tc39/proposal-temporal/blob/main/docs/timezone.md

CC @nordzilla

@nordzilla
Copy link
Member

I will incorporate this into Friday's discussion.

@nordzilla nordzilla added the S-large Size: A few weeks (larger feature, major refactoring) label Apr 3, 2021
@sffc sffc modified the milestones: 2021-Q2-m1, ICU4X 0.4 Apr 19, 2021
@nordzilla nordzilla changed the title Implement time zone calculations Calculate TimeZoneInput from timestamps Jul 22, 2021
@nordzilla nordzilla removed their assignment Aug 25, 2021
@sffc sffc added the help wanted Issue needs an assignee label Aug 26, 2021
@nordzilla nordzilla modified the milestones: ICU4X 0.4, ICU4X 0.5 Aug 26, 2021
@nordzilla nordzilla modified the milestones: ICU4X 0.5, ICU4X 1.0 Jan 20, 2022
@nordzilla nordzilla self-assigned this Jun 6, 2022
@sffc sffc modified the milestones: ICU4X 1.0 (Features), ICU4X 1.1 Jul 28, 2022
@nordzilla nordzilla added the blocked A dependency must be resolved before this is actionable label Aug 16, 2022
@nordzilla nordzilla removed the blocked A dependency must be resolved before this is actionable label Aug 16, 2022
@nordzilla nordzilla modified the milestones: ICU4X 1.1, ICU4X 1.2 Dec 15, 2022
@sffc sffc added C-time-zone Component: Time Zones and removed C-datetime Component: datetime, calendars, time zones labels Dec 22, 2022
@sffc sffc added the U-fuchsia User: Fuchsia label Jan 25, 2023
@sffc
Copy link
Member Author

sffc commented Jan 25, 2023

Note that we will want to support both directions. In ICU these are Calendar::setTime and Calendar::getTime.

@robertbastian
Copy link
Member

Fixed by #5349

@sffc
Copy link
Member Author

sffc commented Sep 17, 2024

#5349 doesn't let us consume a timestamp, which is the title of this issue. We could decide that this issue is out of scope and close it, but that would be a TC decision; the stated issue is definitely not "fixed by" #5349.

@sffc sffc reopened this Sep 17, 2024
@sffc sffc added discuss Discuss at a future ICU4X-SC meeting and removed help wanted Issue needs an assignee labels Sep 17, 2024
@robertbastian
Copy link
Member

robertbastian commented Sep 17, 2024

Oh sorry, I only saw the IXDTF string in the issue and didn't read it in enough detail.

I don't think we want to do this. Going from timestamp + zone identifier to datetime + GMT UTC offset requires the full TZDB, this is what we want to rely on crates like chrono_tz and jiff for. Going from datetime + zone identifier + UTC offset to metazone and zone variant is implemented. I think this is fixed.

@sffc
Copy link
Member Author

sffc commented Sep 17, 2024

Oh sorry, I only saw the IXDTF string in the issue and didn't read it in enough detail.

I don't think we want to do this. Going from timestamp + zone identifier to datetime + GMT UTC offset requires the full TZDB, this is what we want to rely on crates like chrono_tz and jiff for.

It is only in the last 14 days that my thinking has shifted toward us taking a path that avoids the full TZDB in ICU4X. I think we should still have the TC discussion to decide on whether this opinion is shared with others.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-time-zone Component: Time Zones discuss Discuss at a future ICU4X-SC meeting S-large Size: A few weeks (larger feature, major refactoring) T-core Type: Required functionality U-fuchsia User: Fuchsia
Projects
None yet
Development

No branches or pull requests

3 participants