mirror of
https://github.com/umami-software/umami.git
synced 2026-02-10 15:47:13 +01:00
Revert "Fixed realtime chart for relational. Removed getDateArray. Added chart min/max dates."
This reverts commit 647dcb5f25.
This commit is contained in:
parent
82f766342e
commit
5e5b61dc7e
7 changed files with 46 additions and 46 deletions
|
|
@ -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];
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue