Revert "Fixed realtime chart for relational. Removed getDateArray. Added chart min/max dates."

This reverts commit 647dcb5f25.
This commit is contained in:
Mike Cao 2024-08-22 13:14:40 -07:00
parent 82f766342e
commit 5e5b61dc7e
7 changed files with 46 additions and 46 deletions

View file

@ -273,6 +273,19 @@ export function getMinimumUnit(startDate: number | Date, endDate: number | Date)
return 'year';
}
export function getDateFromString(str: string) {
const [ymd, hms] = str.split(' ');
const [year, month, day] = ymd.split('-');
if (hms) {
const [hour, min, sec] = hms.split(':');
return new Date(+year, +month - 1, +day, +hour, +min, +sec);
}
return new Date(+year, +month - 1, +day);
}
export function getDateArray(data: any[], startDate: Date, endDate: Date, unit: string) {
const arr = [];
const { diff, add, start } = DATE_FUNCTIONS[unit];