diff --git a/public/app/features/explore/ExploreTimeControls.tsx b/public/app/features/explore/ExploreTimeControls.tsx index 26493f337ca..b20f42f490d 100644 --- a/public/app/features/explore/ExploreTimeControls.tsx +++ b/public/app/features/explore/ExploreTimeControls.tsx @@ -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 { 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 = () => {