ยฉ 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
Drizzle TeamDT
Drizzle Teamโ€ข2y agoโ€ข
1 reply
francis

New string mode date handling for postgres in 0.30.0 is potentially inconsistent

When selecting a value from a column of type
timestamp with time zone
timestamp with time zone
, I receive the following string format:
2024-01-19 16:54:36.74526+00
2024-01-19 16:54:36.74526+00

When selecting a value from a column of type
date
date
, I receive the following string format:
1990-01-01T00:00:00.000Z
1990-01-01T00:00:00.000Z



It appears the serialization changes for the postgres driver may not be working - the ones here https://github.com/drizzle-team/drizzle-orm/blob/main/drizzle-orm/src/postgres-js/driver.ts#L27

If I define my own custom type as:
  types: {
    date_temp: {
      to: 1082,
      from: [1082],
      serialize: (val: any) => val,
      parse: (val: any) => val,
    }
  }
  types: {
    date_temp: {
      to: 1082,
      from: [1082],
      serialize: (val: any) => val,
      parse: (val: any) => val,
    }
  }

in the postgres-js options, then suddenly I receive the raw sql values I expect:
1990-01-01
1990-01-01
GitHub
drizzle-orm/drizzle-orm/src/postgres-js/driver.ts at main ยท drizzle...
Headless TypeScript ORM with a head. Runs on Node, Bun and Deno. Lives on the Edge and yes, it's a JavaScript ORM too ๐Ÿ˜… - drizzle-team/drizzle-orm
drizzle-orm/drizzle-orm/src/postgres-js/driver.ts at main ยท drizzle...
Drizzle TeamJoin
The official Discord for all Drizzle related projects, such as Drizzle ORM, Drizzle Kit, Drizzle Studio and more!
11,879Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Changing postgres timestamp mode (string -> date) isn't reflected in migrations
Drizzle TeamDTDrizzle Team / help
13mo ago
How to use custom date (1082) type parser in postgres.js for >0.30.0?
Drizzle TeamDTDrizzle Team / help
2y ago
Postgres.js type error string/date
Drizzle TeamDTDrizzle Team / help
2y ago
Timestamp from Postgres returns date object despite schema using string mode?
Drizzle TeamDTDrizzle Team / help
3y ago