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 · 10 comments
Open

tzdb support #193

jhpratt opened this issue Dec 4, 2019 · 10 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.

@alekspickle
Copy link

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

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

4 participants