Skip to content

fix(adapter-pg): historical dates#28212

Merged
jkomyno merged 16 commits intomainfrom
fix/pg-historical-dates
Oct 14, 2025
Merged

fix(adapter-pg): historical dates#28212
jkomyno merged 16 commits intomainfrom
fix/pg-historical-dates

Conversation

@jkomyno
Copy link
Copy Markdown
Contributor

@jkomyno jkomyno commented Oct 3, 2025

@jkomyno jkomyno added this to the 6.17.0 milestone Oct 3, 2025
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Oct 3, 2025

size-limit report 📦

Path Size
packages/client/runtime/library.js 197.77 KB (0%)
packages/client/runtime/library.d.ts 126.71 KB (0%)
packages/client/runtime/binary.js 658.34 KB (0%)
packages/client/runtime/binary.d.ts 26 B (0%)
packages/client/runtime/edge.js 166.66 KB (0%)
packages/client/runtime/edge-esm.js 166.12 KB (0%)
packages/client/runtime/wasm-engine-edge.js 128.78 KB (0%)
packages/client/runtime/index-browser.js 34.5 KB (0%)
packages/client/runtime/index-browser.d.ts 11.64 KB (0%)
packages/cli/build/index.js 2.68 MB (0%)
packages/client/prisma-client-0.0.0.tgz 25.93 MB (+0.01% 🔺)
packages/cli/prisma-0.0.0.tgz 16.74 MB (+0.01% 🔺)
packages/bundle-size/da-workers-libsql/output.tgz 924.94 KB (0%)
packages/bundle-size/da-workers-neon/output.tgz 999.02 KB (-0.01% 🔽)
packages/bundle-size/da-workers-pg/output.tgz 998.19 KB (-0.01% 🔽)
packages/bundle-size/da-workers-planetscale/output.tgz 941.41 KB (+0.01% 🔺)
packages/bundle-size/da-workers-d1/output.tgz 906.8 KB (0%)

@jkomyno jkomyno marked this pull request as ready for review October 8, 2025 08:16
Copilot AI review requested due to automatic review settings October 8, 2025 08:16
@jkomyno jkomyno modified the milestones: 6.17.0, 6.18.0 Oct 8, 2025
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR fixes issues with handling historical dates in the PostgreSQL adapter by preventing JavaScript's 2-digit year interpretation from corrupting dates with years below 100 AD.

  • Replaces the existing timestamp parsing logic with manual parsing to avoid JavaScript Date constructor issues
  • Implements custom parsers for both TIMESTAMP and TIMESTAMPTZ data types that preserve original year values
  • Adds comprehensive test coverage for edge cases including historical dates and timezone handling

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.

File Description
packages/adapter-pg/src/conversion.ts Implements manual timestamp parsing logic to handle historical dates correctly
packages/adapter-pg/src/tests/conversion.test.ts Adds comprehensive test coverage for the new timestamp parsing functionality

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Oct 9, 2025

Client memory tests, node 24, library:

✅ Success

@jacek-prisma
Copy link
Copy Markdown
Contributor

Added a simplified implementation and tested it manually against QE @jkomyno

@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Oct 14, 2025
@jkomyno jkomyno merged commit 6c5a217 into main Oct 14, 2025
408 of 410 checks passed
@jkomyno jkomyno deleted the fix/pg-historical-dates branch October 14, 2025 11:20
aqrln added a commit that referenced this pull request Oct 16, 2025
Conflicts in `packages/config` were automatically solved using
[Mergiraf](https://mergiraf.org/).

Commits:

- **fix: fix neon listener leak (#28255)**
- **feat(qpe): add an option to disable logging to console (#28253)**
- **feat(adapter-mssql): support multiSubnetFailover flag in connection
string (#28261)**
- **chore: use pnpm catalog (#28236)**
- **fix: revert "chore: use pnpm catalog (#28236)" (#28271)**
- **chore: upgrade OpenTelemetry deps and refresh tracing setup in
client (#28268)**
- **chore(deps): update engines to
6.18.0-3.b03d75f1a67e62289420f5697c28a3ff8dbb0424 (#28258)**
- **feat(qpe): expose package version as an export (#28275)**
- **feat: support OpenTelemetry in loadable sub-commands (#28272)**
- **chore(deps): update engines to
6.18.0-6.9bf76dbea6c9e34d59a3577015bd1e94bfda7624 (#28288)**
- **fix(adapter-pg): historical dates (#28212)**
- **chore(deps): update engines to
6.18.0-7.d3fc122f88ca3ce86f67a797debfb179a39ccf48 (#28293)**
- **fix: support multiple Prisma instances with different providers
(#28291)**
- **feat(config): add support for `engine?: 'js' | 'classic'` (#28266)**
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lgtm This PR has been approved by a maintainer

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: PgAdapter corrupts historical dates with 2-digit years (00-99 AD)

4 participants