Dashboard: Add configurable quick ranges for the time picker (#102254)

* Dashboard: Add configurable quick ranges for the time picker

* fix test and linter errors

* update from array to TimeOption

* Switching to grafana-scenes (Part 1 - remove grafana-ui changes

* Update SceneTimePicker initialization

* betterer

* remove hallucinated argument

* Revert "Bump scenes and fix types (#105167)"

This reverts commit c6428dfc74.

* make gen-go

* reset files

* Shorten documentation to increase maintainability

* Update _index.md

* the

---------

Co-authored-by: joshhunt <josh.hunt@grafana.com>
Co-authored-by: Jacob Valdez <jacob.valdez@grafana.com>
This commit is contained in:
Chris Hodges
2025-06-12 17:51:46 +02:00
committed by GitHub
co-authored by joshhunt Jacob Valdez
parent f02ad33fd2
commit e0d27dc0d7
12 changed files with 246 additions and 1 deletions
@@ -2814,6 +2814,40 @@ Used as the default time zone for user preferences. Can be either `browser` for
Set the default start of the week, valid values are: `saturday`, `sunday`, `monday` or `browser` to use the browser locale to define the first day of the week. Default is `browser`.
### `[time_picker]`
This section controls system-wide defaults for the time picker, such as the default quick ranges.
#### `quick_ranges`
Set the default set of quick relative offset time ranges that show up in the right column of the time picker. Each configuration entry must have a `from`, `to`, and `display` field. Any configuration for this field must be in valid JSON format made up of a list of quick range configurations.
The `from` and `to` fields should be valid relative time ranges. For more information the relative time formats, refer to [Time units and relative ranges.](/docs/grafana/<GRAFANA_VERSION>/dashboards/use-dashboards/#time-units-and-relative-ranges). The `from` field is required, but omitting `to` will result in the `from` value being used in both fields.
If no configuration is provided, the default time ranges will be used.
For example:
```ini
[time_picker]
quick_ranges = [
{
"display": "Last 5 minutes",
"from": "now-5m",
"to": "now",
},
{
"display": "Yesterday",
"from": "now-1d/d",
},
{
"display": "Today so far",
"from": "now/d",
"to": "now",
}
]
```
### `[expressions]`
#### `enabled`