This is documentation for the next version of Grafana. For the latest stable release, go to the latest version.

API Reference@grafana/dataparseDateMath

dateMath.parseDateMath() function

dateMath.parseDateMath() function

Parses math part of the time string and shifts supplied time according to that math. See unit tests for examples.


export declare function parseDateMath(mathString: string, time: any, roundUp?: boolean): DateTime | undefined;


import { dateMath } from '@grafana/data';
const { parseDateMath } = dateMath;


Parameter Type Description
mathString string
time any
roundUp boolean If true it will round the time to endOf time unit, otherwise to startOf time unit.


DateTime | undefined