Drizzle TeamDT
Drizzle Teamโ€ข2y ago
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, I receive the following string format: 2024-01-19 16:54:36.74526+00
When selecting a value from a column of type date, I receive the following string format: 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,
    }
  }

in the postgres-js options, then suddenly I receive the raw sql values I expect: 1990-01-01
GitHub
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
Was this page helpful?