time.ts 365 B

123456789101112131415161718
  1. import { isDateTime, RawTimeRange, TimeRange } from '@grafana/data';
  2. export const toRawTimeRange = (range: TimeRange): RawTimeRange => {
  3. let from = range.raw.from;
  4. if (isDateTime(from)) {
  5. from = from.valueOf().toString(10);
  6. }
  7. let to = range.raw.to;
  8. if (isDateTime(to)) {
  9. to = to.valueOf().toString(10);
  10. }
  11. return {
  12. from,
  13. to,
  14. };
  15. };