mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Use either moment objects (for absolute times in the datepicker) or string (for relative time) (#33315)
This commit is contained in:
parent
b3642eb18d
commit
3ee925610a
@ -3,7 +3,7 @@ import React, { Component } from 'react';
|
||||
|
||||
// Types
|
||||
import { ExploreId } from 'app/types';
|
||||
import { TimeRange, TimeZone, RawTimeRange, dateTimeForTimeZone } from '@grafana/data';
|
||||
import { TimeRange, TimeZone, RawTimeRange, dateTimeForTimeZone, dateMath } from '@grafana/data';
|
||||
|
||||
// State
|
||||
|
||||
@ -42,7 +42,13 @@ export class ExploreTimeControls extends Component<Props> {
|
||||
onMoveBack = () => this.onMoveTimePicker(-1);
|
||||
|
||||
onChangeTimePicker = (timeRange: TimeRange) => {
|
||||
this.props.onChangeTime(timeRange.raw);
|
||||
const adjustedFrom = dateMath.isMathString(timeRange.raw.from) ? timeRange.raw.from : timeRange.from;
|
||||
const adjustedTo = dateMath.isMathString(timeRange.raw.to) ? timeRange.raw.to : timeRange.to;
|
||||
|
||||
this.props.onChangeTime({
|
||||
from: adjustedFrom,
|
||||
to: adjustedTo,
|
||||
});
|
||||
};
|
||||
|
||||
onZoom = () => {
|
||||
|
Loading…
Reference in New Issue
Block a user