grafana/public/app/features/explore/utils/time.ts

19 lines
365 B
TypeScript
Raw Normal View History

import { isDateTime, RawTimeRange, TimeRange } from '@grafana/data';
export const toRawTimeRange = (range: TimeRange): RawTimeRange => {
let from = range.raw.from;
if (isDateTime(from)) {
from = from.valueOf().toString(10);
}
let to = range.raw.to;
if (isDateTime(to)) {
to = to.valueOf().toString(10);
}
return {
from,
to,
};
};