Time Range: Using relative time takes timezone into account (#74013)
* account for timezone when using relative times
Co-authored-by: eledobleefe <laura.fernandez@grafana.com>
Co-authored-by: Joao Silva <joao.silva@grafana.com>
Co-authored-by: L-M-K-B <48948963+L-M-K-B@users.noreply.github.com>
Co-authored-by: joshhunt <josh@trtr.co>
Co-authored-by: tskarhed <1438972+tskarhed@users.noreply.github.com>
* keep as it was originally for now
* add e2e test for relative time zone overrides
* empty commit to add coauthors
Co-authored-by: eledobleefe <laura.fernandez@grafana.com>
Co-authored-by: Joao Silva <joao.silva@grafana.com>
Co-authored-by: L-M-K-B <48948963+L-M-K-B@users.noreply.github.com>
Co-authored-by: joshhunt <josh@trtr.co>
Co-authored-by: tskarhed <1438972+tskarhed@users.noreply.github.com>
* fix types
* switch to using table panel in e2e test
* use regex for partial text match
* actually go to the dashboard...
* use include.text
* check for visibility first
* try waiting on backend request to complete
* CI driven development is fun
* make sure we're waiting for both data query calls
* open dashboard instead
* kick drone
* Revert "open dashboard instead"
This reverts commit bab9c77c4d.
* check timezone second
* refactor to avoid detached elements
---------
Co-authored-by: eledobleefe <laura.fernandez@grafana.com>
Co-authored-by: Joao Silva <joao.silva@grafana.com>
Co-authored-by: L-M-K-B <48948963+L-M-K-B@users.noreply.github.com>
Co-authored-by: joshhunt <josh@trtr.co>
Co-authored-by: tskarhed <1438972+tskarhed@users.noreply.github.com>
This commit is contained in:
co-authored by
eledobleefe
Joao Silva
L-M-K-B
joshhunt
tskarhed
parent
1922f4c9a1
commit
e2724f39d9
@@ -130,6 +130,20 @@ export const dateTimeForTimeZone = (
|
||||
return toUtc(input, formatInput);
|
||||
}
|
||||
|
||||
if (timezone && timezone !== 'browser') {
|
||||
let result: moment.Moment;
|
||||
|
||||
if (typeof input === 'string' && formatInput) {
|
||||
result = moment.tz(input, formatInput, timezone);
|
||||
} else {
|
||||
result = moment.tz(input, timezone);
|
||||
}
|
||||
|
||||
if (isDateTime(result)) {
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
return dateTime(input, formatInput);
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user