Skip to content

[Pg] Add Temporal mapping support#4475

Open
XiNiHa wants to merge 3 commits intodrizzle-team:mainfrom
XiNiHa:temporal
Open

[Pg] Add Temporal mapping support#4475
XiNiHa wants to merge 3 commits intodrizzle-team:mainfrom
XiNiHa:temporal

Conversation

@XiNiHa
Copy link
Copy Markdown

@XiNiHa XiNiHa commented Apr 30, 2025

Related: #1776

  • Mostly followed the opinions and approaches of jiff (Temporal-like datetime library in Rust) integration for sqlx: Support jiff as a date time lib backend launchbadge/sqlx#3487
    • timestamp => PlainDateTime
    • timestamptz => Instant
    • date => PlainDate
    • time => PlainTime
    • interval => Duration
  • I've considered vendoring the postgres-interval dependency, but I'm not sure about the license issues. Some help would be appreciated.
  • I don't know what ColumnDataType is used for, therefore I didn't add any Temporal types there and just used 'date's. Let me know if it should be added.
  • I vendored the type definitions for Temporal from its reference polyfill, but it should be replaced with Add Temporal (Stage 3) types microsoft/TypeScript#60164 later.

@dahlia
Copy link
Copy Markdown

dahlia commented Sep 15, 2025

@XiNiHa Hey! This PR has conflicts now. 😅 Could you rebase when you get a chance?

The maintainers have been silent, but maybe resolving conflicts will help get their attention!

@XiNiHa
Copy link
Copy Markdown
Author

XiNiHa commented Sep 15, 2025

Sure! I'll make it done until tomorrow 😋

@SamPearlma
Copy link
Copy Markdown

I picked this up and rebased it onto the latest main.

I also added test coverage, wired in the Temporal polyfill for Vitest, and adjusted the interval handling (removed the fallback due to unsafe parsing behavior with certain PostgreSQL interval formats).

New PR here for continuation/review:
#5656

@dahlia

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.

3 participants