From 5feea2bfa7e940f40bdfd4ff6daca5522f8705b8 Mon Sep 17 00:00:00 2001 From: Maxwell <145994855+ping-maxwell@users.noreply.github.com> Date: Mon, 2 Mar 2026 09:59:18 -0800 Subject: [PATCH] fix: drizzle-adapter failing date transformation (#8289) --- packages/drizzle-adapter/src/drizzle-adapter.ts | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/packages/drizzle-adapter/src/drizzle-adapter.ts b/packages/drizzle-adapter/src/drizzle-adapter.ts index 43730ab7a9..b92167a1e0 100644 --- a/packages/drizzle-adapter/src/drizzle-adapter.ts +++ b/packages/drizzle-adapter/src/drizzle-adapter.ts @@ -671,10 +671,17 @@ export const drizzleAdapter = (db: DB, config: DrizzleAdapterConfig) => { ? true : false, supportsArrays: config.provider === "pg" ? true : false, - // not all providers support dates - // one such example case is https://github.com/better-auth/better-auth/issues/7819 - // it's safe to set to `false` without checking for provider, because it it is dates the transformation doesn't apply anyway. - supportsDates: false, + customTransformOutput: ({ data, fieldAttributes }) => { + // not all providers support dates + // one such example case is https://github.com/better-auth/better-auth/issues/7819 + if (fieldAttributes.type === "date") { + if (data === null || data === undefined) { + return data; + } + return new Date(data); + } + return data; + }, transaction: (config.transaction ?? false) ? (cb) =>