Skip to content

Fix serialization of times with offset - #1384

Open
robsdedude wants to merge 2 commits into
neo4j:6.xfrom
robsdedude:fix-offset-time-serialization
Open

robsdedude wants to merge 2 commits into
neo4j:6.xfrom
robsdedude:fix-offset-time-serialization

Conversation

@robsdedude

@robsdedude robsdedude commented Dec 1, 2026 •

Copy link
Copy Markdown
Member

Fix serialization of neo4j.time.Time and datetime.time objects with attached timezones, both via Bolt and HTTP Query API.

Via Bolt

Fixed Offset

  • Used to only work with pytz's tzinfo implementations
  • Now works with all tzinfo implementations

Non-Fixed Offset

  • Used to only work with pytz's tzinfo implementations, but didn't round-trip properly, as Neo4j only handles time with no time zone of fixed offset time zones.
  • pytz time zones will now emit a warning; a future major version of the driver will turn the warning into an error.
  • Other tzinfo implementations will be rejected with a clear error message.

HTTP Query API (still in preview)

Fixed Offset

worked fine before (still dose 😉)

Non-Fixed Offset

  • Used to transmit a time without timezone instead
  • Raises a clear error now instead.

Fixes #1380

Fixes: DRIVERS-721

Special thanks to @ChayaNine for the initial investigation in #1381

@robsdedude
robsdedude force-pushed the fix-offset-time-serialization branch 3 times, most recently from 52dcb50 to 1ab3295 Compare December 3, 2026 15:58
@robsdedude robsdedude mentioned this pull request Dec 4, 2026
@robsdedude
robsdedude force-pushed the fix-offset-time-serialization branch from 256d5ef to dcb165f Compare December 4, 2026 09:00
@robsdedude
robsdedude marked this pull request as ready for review December 4, 2026 11:38
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.

A datetime.time with a datetime.timezone can't be sent as a parameter: utcoffset(dt) argument must be a datetime instance

1 participant