Skip to content

Add conversions for chrono's Local timezone#5174

Merged
bschoenmaeckers merged 1 commit intoPyO3:mainfrom
bschoenmaeckers:chrono-local
Jun 3, 2025
Merged

Add conversions for chrono's Local timezone#5174
bschoenmaeckers merged 1 commit intoPyO3:mainfrom
bschoenmaeckers:chrono-local

Conversation

@bschoenmaeckers
Copy link
Copy Markdown
Member

This add IntoPyObject & FromPyObject implementations for DateTime<Local>. It will create datetime instances with a ZoneInfo bound to the local iana name. Furthermore when converting into rust it will validate it has the same timezone. This currently does not handle naive python datetimes and will throw a exception when it does not match (or contains) the local timezone.

closes #5169

@bschoenmaeckers bschoenmaeckers force-pushed the chrono-local branch 3 times, most recently from c35d3a3 to 6bb67b3 Compare June 2, 2025 13:30
Copy link
Copy Markdown
Member

@davidhewitt davidhewitt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, I guess I will ship this in 0.25.1 given that users sort of had this before we fixed the conversions to not just make fixed offsets everywhere.

@davidhewitt davidhewitt added this pull request to the merge queue Jun 2, 2025
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Jun 2, 2025
@bschoenmaeckers bschoenmaeckers enabled auto-merge June 3, 2025 07:32
@bschoenmaeckers bschoenmaeckers added this pull request to the merge queue Jun 3, 2025
Merged via the queue into PyO3:main with commit b050c87 Jun 3, 2025
43 of 45 checks passed
@bschoenmaeckers bschoenmaeckers deleted the chrono-local branch June 3, 2025 08:47
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.

Function can not return chrono::DateTime<Local> since 0.25.0

2 participants