The open and composable observability and data visualization platform. Visualize metrics, logs, and traces from multiple sources like Prometheus, Loki, Elasticsearch, InfluxDB, Postgres and many more.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
grafana/docs/sources/packages_api/data/datemath/parse.md

1.2 KiB

+++

-----------------------------------------------------------------------

Do not edit this file. It is automatically generated by API Documenter.

-----------------------------------------------------------------------

title = "parse" keywords = ["grafana","documentation","sdk","@grafana/data"] type = "docs" +++

dateMath.parse() function

dateMath.parse() function

Parses different types input to a moment instance. There is a specific formatting language that can be used if text arg is string. See unit tests for examples.

Signature

export declare function parse(text?: string | DateTime | Date | null, roundUp?: boolean, timezone?: TimeZone): DateTime | undefined;

Import

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

Parameters

Parameter Type Description
text string | DateTime | Date | null
roundUp boolean See parseDateMath function.
timezone TimeZone Only string 'utc' is acceptable here, for anything else, local timezone is used.

Returns:

DateTime | undefined