mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
PublicDashboards: Support timezone on query API (#68560)
This commit is contained in:
committed by
GitHub
parent
7ea9be6832
commit
fc374f93a3
@@ -113,7 +113,11 @@ export class PublicDashboardDataSource extends DataSourceApi<DataQuery, DataSour
|
||||
intervalMs,
|
||||
maxDataPoints,
|
||||
queryCachingTTL,
|
||||
timeRange: { from: fromRange.valueOf().toString(), to: toRange.valueOf().toString() },
|
||||
timeRange: {
|
||||
from: fromRange.valueOf().toString(),
|
||||
to: toRange.valueOf().toString(),
|
||||
timezone: this.getBrowserTimezone(),
|
||||
},
|
||||
};
|
||||
|
||||
return getBackendSrv()
|
||||
@@ -155,4 +159,9 @@ export class PublicDashboardDataSource extends DataSourceApi<DataQuery, DataSour
|
||||
testDatasource(): Promise<TestDataSourceResponse> {
|
||||
return Promise.resolve({ message: '', status: '' });
|
||||
}
|
||||
|
||||
// Try to get the browser timezone otherwise return blank
|
||||
getBrowserTimezone(): string {
|
||||
return window.Intl?.DateTimeFormat().resolvedOptions()?.timeZone || '';
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user