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

API Reference@grafana/dataparseDuration

parseDuration() function

parseDuration() function

parseDuration parses duration string into datefns Duration object

Signature

export declare function parseDuration(duration: string): Duration;

Import

import { parseDuration } from '@grafana/data';

Parameters

Parameter Type Description
duration string string to convert. For example ‘2m’, ‘5h 20s’

Returns:

Duration