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

tzdb support #193

Open
jhpratt opened this issue Dec 4, 2019 · 12 comments
Open

tzdb support #193

jhpratt opened this issue Dec 4, 2019 · 12 comments
Assignees
Labels
A-core Area: anything not otherwise covered C-feature-request Category: a new feature (not already implemented) C-tracking-issue Category: tracking issue for a feature/release E-hard Significant experience needed.
Milestone

Comments

@jhpratt
Copy link
Member

jhpratt commented Dec 4, 2019

This is a general tracking issue for all support related to the IANA Time Zone database.

At some point in the future, my hope is to have full support for the tzdb via a ZonedDateTime struct and a Period type.

General inspiration could come from C++20's proposed API for timezones [ref]. It should be possible to build a static/const singleton by using a build script.

@jhpratt jhpratt added the C-feature-request Category: a new feature (not already implemented) label Dec 4, 2019
@jhpratt jhpratt added this to the tzdb support milestone Dec 4, 2019
@jhpratt jhpratt added the C-tracking-issue Category: tracking issue for a feature/release label Apr 19, 2020
@jhpratt jhpratt self-assigned this Apr 20, 2020
@jhpratt jhpratt added A-core Area: anything not otherwise covered E-hard Significant experience needed. labels May 16, 2020
@jhpratt jhpratt mentioned this issue Oct 30, 2021
@jhpratt
Copy link
Member Author

jhpratt commented Nov 1, 2021

The tzfile crate was recently brought to my attention and may be a decent starting point once I get around to implementing this.

@Yuri6037
Copy link

Yuri6037 commented Feb 7, 2022

I've just begun implementing support for tz database without relying on chrono dependency.

EDIT: link to repository for anyone interested: https://github.com/Yuri6037/time-tz

@Yuri6037
Copy link

Yuri6037 commented Feb 7, 2022

Quick update: I've just finished initial version with support for timezone conversions: https://crates.io/crates/time-tz

@jhpratt
Copy link
Member Author

jhpratt commented Feb 7, 2022

Thank you! It's by no means the kind of API that I've envisioned, but having something will hopefully be helpful to others until I get around to this — whenever that may be.

@Yuri6037
Copy link

Yuri6037 commented Feb 7, 2022

This is not yet finished. I don't plan to leave the API as it is forever. The reason why it's done this way is because parsing the tz info and setting up the actual lookup code was more complicated than I've anticipated.

My plan is to have an API similar to chrono-tz to quickly access the various timezones.

If anyone needs features that are not currently supported by time-tz feel free to open issues on the GitHub.

@jhpratt
Copy link
Member Author

jhpratt commented Feb 8, 2022

The reason why it's done this way is because parsing the tz info and setting up the actual lookup code was more complicated than I've anticipated.

That's why this issue is E-hard 🙂 I look forward to seeing what you are able to do.

@Yuri6037
Copy link

Yuri6037 commented Feb 12, 2022

Just a quick update: I've finally finished API v2 which now allows to very quickly re-implement localtime:

    let system_tz = time_tz::system::get_timezone()
        .expect("Failed to find system timezone");
    let localtime = OffsetDateTime::now_utc().to_timezone(system_tz);
    // the system timezone name in IANA format is in system_tz.name() now

@LinusU
Copy link

LinusU commented Oct 19, 2022

Something to keep an eye on/draw inspiration from is unicode-org/icu4x#1003 which is the tracking issue for ZonedDateTime in icu4x. It draws inspiration from the TC39 Temporal standard which I've personally come to like very much!

@jhpratt
Copy link
Member Author

jhpratt commented Oct 19, 2022

Thanks @LinusU! I am aware of temporal, but I'll definitely check out that issue.

@olekspickle
Copy link

@Yuri6037 thank you for the crate dude, it's awesome!

@maxcountryman
Copy link

I'd be curious to hear more about where this sits. I've been looking at jiff as a recent TC39 entrant. It's cool to see new ideas in this space and I think there's at least one great concept in the Span type. That said, time's overall design is preferable to me personally, with the largest omission being DST aware arithmetic. If time adopts time zone support, it seems like a great step toward offering a generalized date-time solution without serious compromise.

@jhpratt
Copy link
Member Author

jhpratt commented Oct 5, 2024

@maxcountryman It's a significant effort that I have worked on on-and-off for a while now. None of the code I've written is public yet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-core Area: anything not otherwise covered C-feature-request Category: a new feature (not already implemented) C-tracking-issue Category: tracking issue for a feature/release E-hard Significant experience needed.
Projects
None yet
Development

No branches or pull requests

5 participants