From 6d32877dbbe718ebc09f63c72c030a19c3433a92 Mon Sep 17 00:00:00 2001 From: Tomas Sivicki Date: Mon, 19 Jan 2026 23:38:32 +0100 Subject: [PATCH] fix(adapter): transforms output back to Date for better-auth compatibility while this aligns with Convex stored _creationTime & numbers, this should still be transformed back to a Date instance or better-auth handles the formatting wrong fix #224 --- src/client/adapter.ts | 2 +- src/component/adapterTest.ts | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/client/adapter.ts b/src/client/adapter.ts index 4194bc7..002d4fa 100644 --- a/src/client/adapter.ts +++ b/src/client/adapter.ts @@ -146,7 +146,7 @@ export const convexAdapter = < }, customTransformOutput: ({ data, fieldAttributes }) => { if (data && fieldAttributes.type === "date") { - return new Date(data).getTime(); + return new Date(data); } return data; }, diff --git a/src/component/adapterTest.ts b/src/component/adapterTest.ts index 11b857c..1a9492b 100644 --- a/src/component/adapterTest.ts +++ b/src/component/adapterTest.ts @@ -499,5 +499,6 @@ function runCustomAdapterTests({ where: [{ field: "createdAt", value: new Date().toISOString() }], }) ).toEqual(user); + expect(user.createdAt).toBeInstanceOf(Date); }); }