From be157b845706c3b0e85f5385a5d218fa50eab90f Mon Sep 17 00:00:00 2001 From: Ivana Huckova <30407135+ivanahuckova@users.noreply.github.com> Date: Fri, 27 Mar 2020 10:04:43 +0100 Subject: [PATCH] Update raw range only if isMathString (#23122) --- .../TimePicker/TimePickerContent/mapper.ts | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) 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 => {