diff --git a/packages/grafana-ui/src/components/TimePicker/TimePickerContent/mapper.ts b/packages/grafana-ui/src/components/TimePicker/TimePickerContent/mapper.ts index 0ad419214c9..01f4487c755 100644 --- a/packages/grafana-ui/src/components/TimePicker/TimePickerContent/mapper.ts +++ b/packages/grafana-ui/src/components/TimePicker/TimePickerContent/mapper.ts @@ -40,25 +40,16 @@ export const mapStringsToTimeRange = (from: string, to: string, roundup?: boolea const fromDate = stringToDateTimeType(from, roundup, timeZone); const toDate = stringToDateTimeType(to, roundup, timeZone); - if (dateMath.isMathString(from) || dateMath.isMathString(to)) { - return { - from: fromDate, - to: toDate, - raw: { - from, - to, - }, - }; - } - - return { + const timeRangeObject: any = { from: fromDate, to: toDate, raw: { - from: fromDate, - to: toDate, + from: dateMath.isMathString(from) ? from : fromDate, + to: dateMath.isMathString(to) ? to : toDate, }, }; + + return timeRangeObject; }; const stringToDateTime = (value: string | DateTime, roundUp?: boolean, timeZone?: TimeZone): DateTime => {