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
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
typescript
export declare function parse(text?: string | DateTime | Date | null, roundUp?: boolean, timezone?: TimeZone, fiscalYearStartMonth?: number): DateTime | undefined;Import
typescript
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. |
| fiscalYearStartMonth | number |
Returns:
DateTime | undefined
Was this page helpful?
Related resources from Grafana Labs
Additional helpful documentation, links, and articles:
Scroll for more