Skip to content

Bind DateTime<Local> as offset-aware text - #27

Merged
lovasoa merged 3 commits into
mainfrom
review/chrono-local-utc
Nov 28, 2026
Merged

lovasoa merged 3 commits into
mainfrom
review/chrono-local-utc

Conversation

@lovasoa

@lovasoa lovasoa commented Nov 19, 2026 •

Copy link
Copy Markdown
Collaborator

DateTime<Local> now uses the same RFC 3339 binding as DateTime<FixedOffset> and DateTime<Utc>. A timezone-aware destination can use the supplied offset to preserve the instant. PostgreSQL and DuckDB use the offset when casting to TIMESTAMP WITH TIME ZONE and discard it when casting to plain TIMESTAMP.

This changes the parameter type from an ODBC timestamp to text. Conversion depends on the database and query. To keep the previous native wall-clock binding, pass value.naive_local(). For plain timestamp columns that store UTC by convention, pass value.naive_utc().

Refs #10 and #11.

@lovasoa
lovasoa force-pushed the review/chrono-local-utc branch from 7aff226 to 11c2290 Compare November 27, 2026 16:13
@lovasoa lovasoa changed the title Preserve the instant when binding chrono DateTime<Local> Bind DateTime<Local> as offset-aware text Nov 28, 2026
@lovasoa
lovasoa merged commit 87271d0 into main Nov 28, 2026
8 checks passed
@lovasoa
lovasoa deleted the review/chrono-local-utc branch November 28, 2026 16:30
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.

1 participant