mirror of
https://github.com/grafana/grafana.git
synced 2025-02-13 00:55:47 -06:00
19 lines
365 B
TypeScript
19 lines
365 B
TypeScript
|
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,
|
||
|
};
|
||
|
};
|