mirror of
https://github.com/umami-software/umami.git
synced 2026-02-10 23:57:12 +01:00
fix date validation for getDataType
This commit is contained in:
parent
490bb11771
commit
09869bbe5a
1 changed files with 2 additions and 2 deletions
|
|
@ -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…
Add table
Add a link
Reference in a new issue