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..556c4f5 100644 --- a/src/component/adapterTest.ts +++ b/src/component/adapterTest.ts @@ -485,19 +485,21 @@ function runCustomAdapterTests({ test("should be able to compare against a date", async () => { const adapter = await getAdapter(); + const now = new Date().toISOString(); const user = await adapter.create({ model: "user", data: { name: "foo", email: "foo@bar.com", - createdAt: new Date().toISOString(), + createdAt: now, }, }); expect( await adapter.findOne({ model: "user", - where: [{ field: "createdAt", value: new Date().toISOString() }], + where: [{ field: "createdAt", value: now }], }) ).toEqual(user); + expect(user.createdAt).toBeInstanceOf(Date); }); }