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

api: add TimeZone::to_fixed_offset #170

Merged
merged 1 commit into from
Dec 27, 2024

Conversation

bschoenmaeckers
Copy link
Contributor

closed #169

This adds a new API for converting a `TimeZone` to a fixed offset, but
*only* when it's safe to do so (i.e., the time zone is itself just a
fixed offset).

I'm not a huge fan of adding this API because I feel like it confuses
things a bit and could potentially lead to decision paralysis. But I
think the use case makes sense (needing to interoperate with Python's
datetime system through pyo3, which requires needing to know more about
the "type" of a time zone). We also call this out (albeit in more vague
terms) in the docs to hopefully warn folks off of it.

Closes BurntSushi#169
@BurntSushi
Copy link
Owner

Thanks! I've rebased this on master, fixed up the docs and improved the error message a bit.

@BurntSushi BurntSushi merged commit 01fa37d into BurntSushi:master Dec 27, 2024
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement TryFrom<TimeZone> for Offset for fixed & utc timezones.
2 participants