feature(dashboard,api): add timezone support

* feat(dashboard): add support for today, yesterday etc (timezones)

* fix(db): escape js dates

* fix(dashboard): ensure we support default timezone

* final fixes

* remove complete series and add sql with fill instead
This commit is contained in:
Carl-Gerhard Lindesvärd
2025-05-23 11:26:44 +02:00
committed by GitHub
parent 46bfeee131
commit 680727355b
48 changed files with 1817 additions and 758 deletions

View File

@@ -16,9 +16,14 @@ export const timeWindows = {
},
today: {
key: 'today',
label: '24 hours',
label: 'Today',
shortcut: 'D',
},
yesterday: {
key: 'yesterday',
label: 'Yesterday',
shortcut: 'E',
},
'7d': {
key: '7d',
label: 'Last 7 days',
@@ -29,6 +34,16 @@ export const timeWindows = {
label: 'Last 30 days',
shortcut: 'T',
},
'6m': {
key: '6m',
label: 'Last 6 months',
shortcut: '6',
},
'12m': {
key: '12m',
label: 'Last 12 months',
shortcut: '0',
},
monthToDate: {
key: 'monthToDate',
label: 'Month to Date',
@@ -167,7 +182,10 @@ export function isMinuteIntervalEnabledByRange(
export function isHourIntervalEnabledByRange(range: keyof typeof timeWindows) {
return (
isMinuteIntervalEnabledByRange(range) || range === 'today' || range === '7d'
isMinuteIntervalEnabledByRange(range) ||
range === 'today' ||
range === 'yesterday' ||
range === '7d'
);
}
@@ -177,7 +195,7 @@ export function getDefaultIntervalByRange(
if (range === '30min' || range === 'lastHour') {
return 'minute';
}
if (range === 'today') {
if (range === 'today' || range === 'yesterday') {
return 'hour';
}
if (