From ffef88731df9479c72b7de38ec3a2eeeaf64646a Mon Sep 17 00:00:00 2001 From: Tanmay Banage <75128196+xnsei@users.noreply.github.com> Date: Wed, 13 Sep 2023 09:31:48 +0530 Subject: [PATCH] fix: Fix string gets converted to date causing validation error (#793) --- packages/lib/time.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/lib/time.ts b/packages/lib/time.ts index c270b85829..2fc54b4260 100644 --- a/packages/lib/time.ts +++ b/packages/lib/time.ts @@ -97,7 +97,7 @@ export const getTodaysDateFormatted = (seperator: string) => { export function convertDatesInObject(obj: any) { for (let key in obj) { - if (typeof obj[key] === "string" && !isNaN(Date.parse(obj[key]))) { + if ((key === "createdAt" || key === "updatedAt") && !isNaN(Date.parse(obj[key]))) { obj[key] = new Date(obj[key]); } else if (typeof obj[key] === "object" && obj[key] !== null) { convertDatesInObject(obj[key]);