Menu

Important: This documentation is about an older version. It's relevant only to the release noted, many of the features and functions have been updated or replaced. Please view the current version.

Enterprise Open source

parseDuration() function

parseDuration() function

parseDuration parses duration string into datefns Duration object

Signature

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

Import

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

Parameters

ParameterTypeDescription
durationstringstring to convert. For example ‘2m’, ‘5h 20s’

Returns:

Duration