fix: drizzle-adapter failing date transformation (#8289)

This commit is contained in:
Maxwell
2026-03-02 09:59:18 -08:00
committed by GitHub
parent e8881d6495
commit 5feea2bfa7

View File

@@ -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) =>