mirror of
https://github.com/kremalicious/umami.git
synced 2025-02-14 21:10:34 +01:00
fix date validation for getDataType
This commit is contained in:
parent
490bb11771
commit
09869bbe5a
@ -1,4 +1,4 @@
|
|||||||
import { isValid, parseISO } from 'date-fns';
|
import { isValid } from 'date-fns';
|
||||||
import { DATA_TYPE } from './constants';
|
import { DATA_TYPE } from './constants';
|
||||||
import { DynamicDataType } from './types';
|
import { DynamicDataType } from './types';
|
||||||
|
|
||||||
@ -28,7 +28,7 @@ export function flattenJSON(
|
|||||||
export function getDataType(value: any): string {
|
export function getDataType(value: any): string {
|
||||||
let type: string = typeof value;
|
let type: string = typeof value;
|
||||||
|
|
||||||
if ((type === 'string' && isValid(value)) || isValid(parseISO(value))) {
|
if ((type === 'string' && isValid(value)) || isValid(new Date(value))) {
|
||||||
type = 'date';
|
type = 'date';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user