From 09869bbe5a88ae53d834121f97d3b16ecf8a99b2 Mon Sep 17 00:00:00 2001 From: Francis Cao Date: Thu, 22 Feb 2024 22:31:43 -0800 Subject: [PATCH] fix date validation for getDataType --- src/lib/data.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lib/data.ts b/src/lib/data.ts index 47023bb4..5b502c5d 100644 --- a/src/lib/data.ts +++ b/src/lib/data.ts @@ -1,4 +1,4 @@ -import { isValid, parseISO } from 'date-fns'; +import { isValid } from 'date-fns'; import { DATA_TYPE } from './constants'; import { DynamicDataType } from './types'; @@ -28,7 +28,7 @@ export function flattenJSON( export function getDataType(value: any): string { let type: string = typeof value; - if ((type === 'string' && isValid(value)) || isValid(parseISO(value))) { + if ((type === 'string' && isValid(value)) || isValid(new Date(value))) { type = 'date'; }