ยฉ 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
Drizzle TeamDT
Drizzle Teamโ€ข3y agoโ€ข
8 replies
juanvilladev

date column not being returned as string by drizzle

Hello, I have the following table:
export const productSnapshot = pgTable("product_snapshot", {
    productId: text("product_id").notNull().references(() => product.id),
    // You can use { mode: "bigint" } if numbers are exceeding js number limitations
    version: bigint("version", { mode: "number" }).notNull(),
    material: text("material").notNull(),
    shape: text("shape").notNull(),
    alloy: text("alloy").notNull(),
    // You can use { mode: "bigint" } if numbers are exceeding js number limitations
    thickness: bigint("thickness", { mode: "number" }).notNull(),
    dimension: text("dimension").notNull(),
    // You can use { mode: "bigint" } if numbers are exceeding js number limitations
    weightByFoot: bigint("weight_by_foot", { mode: "number" }).notNull(),
    description: text("description").notNull(),
    effectiveDate: timestamp("effective_date", { withTimezone: true, mode: 'string' }).defaultNow().notNull(),
},
export const productSnapshot = pgTable("product_snapshot", {
    productId: text("product_id").notNull().references(() => product.id),
    // You can use { mode: "bigint" } if numbers are exceeding js number limitations
    version: bigint("version", { mode: "number" }).notNull(),
    material: text("material").notNull(),
    shape: text("shape").notNull(),
    alloy: text("alloy").notNull(),
    // You can use { mode: "bigint" } if numbers are exceeding js number limitations
    thickness: bigint("thickness", { mode: "number" }).notNull(),
    dimension: text("dimension").notNull(),
    // You can use { mode: "bigint" } if numbers are exceeding js number limitations
    weightByFoot: bigint("weight_by_foot", { mode: "number" }).notNull(),
    description: text("description").notNull(),
    effectiveDate: timestamp("effective_date", { withTimezone: true, mode: 'string' }).defaultNow().notNull(),
},


Whenever I try to query the effectiveDate from the drizzle table, TypeScript says the return type will be string, however, I verified that I am actually receiving a Date object. I am using mode 'string' as you can see. Is this a known issue?
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

TIMESTAMPTZ is returned as string instead of Date object
Drizzle TeamDTDrizzle Team / help
3y ago
json column returning as string
Drizzle TeamDTDrizzle Team / help
6mo ago
Selecting DATE_TRUNC returns string but types as Date
Drizzle TeamDTDrizzle Team / help
2mo ago
Infer date values in jsonb column as Date object
Drizzle TeamDTDrizzle Team / help
2y ago