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.

Signature

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

Import

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

Parameters

ParameterTypeDescription
mathStringstring
timeany
roundUpbooleanIf true it will round the time to endOf time unit, otherwise to startOf time unit.
fiscalYearStartMonthnumber

Returns:

DateTime | undefined