mirror of
https://github.com/grafana/grafana.git
synced 2025-07-30 07:22:09 +08:00

* added packages reference menu item. * removed the draft flag. * Updated docs by running script.
39 lines
1.2 KiB
Markdown
39 lines
1.2 KiB
Markdown
+++
|
|
# -----------------------------------------------------------------------
|
|
# 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.
|
|
|
|
<b>Signature</b>
|
|
|
|
```typescript
|
|
export declare function parse(text?: string | DateTime | Date | null, roundUp?: boolean, timezone?: TimeZone): DateTime | undefined;
|
|
```
|
|
<b>Import</b>
|
|
|
|
```typescript
|
|
import { dateMath } from '@grafana/data';
|
|
const { parse } = dateMath;
|
|
```
|
|
<b>Parameters</b>
|
|
|
|
| Parameter | Type | Description |
|
|
| --- | --- | --- |
|
|
| text | <code>string | DateTime | Date | null</code> | |
|
|
| roundUp | <code>boolean</code> | See parseDateMath function. |
|
|
| timezone | <code>TimeZone</code> | Only string 'utc' is acceptable here, for anything else, local timezone is used. |
|
|
|
|
<b>Returns:</b>
|
|
|
|
`DateTime | undefined`
|
|
|