fix date validation for getDataType

This commit is contained in:
Francis Cao 2024-02-22 22:31:43 -08:00
parent 490bb11771
commit 09869bbe5a
1 changed files with 2 additions and 2 deletions

View File

@ -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';
}