Update raw range only if isMathString (#23122)

This commit is contained in:
Ivana Huckova 2020-03-27 10:04:43 +01:00 committed by GitHub
parent 16306ccacb
commit be157b8457
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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 => {