mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
timerange: new quick ranges, month and year so far
The new time ranges can also be used for time range overrides in the override relative time field. E.g. now/M or now/y.
This commit is contained in:
@@ -18,9 +18,11 @@ var rangeOptions = [
|
||||
{ from: 'now/d', to: 'now/d', display: 'Today', section: 2 },
|
||||
{ from: 'now/d', to: 'now', display: 'Today so far', section: 2 },
|
||||
{ from: 'now/w', to: 'now/w', display: 'This week', section: 2 },
|
||||
{ from: 'now/w', to: 'now', display: 'This week so far', section: 2 },
|
||||
{ from: 'now/w', to: 'now', display: 'This week so far', section: 2 },
|
||||
{ from: 'now/M', to: 'now/M', display: 'This month', section: 2 },
|
||||
{ from: 'now/M', to: 'now', display: 'This month so far', section: 2 },
|
||||
{ from: 'now/y', to: 'now/y', display: 'This year', section: 2 },
|
||||
{ from: 'now/y', to: 'now', display: 'This year so far', section: 2 },
|
||||
|
||||
{ from: 'now-1d/d', to: 'now-1d/d', display: 'Yesterday', section: 1 },
|
||||
{ from: 'now-2d/d', to: 'now-2d/d', display: 'Day before yesterday', section: 1 },
|
||||
|
||||
@@ -47,6 +47,16 @@ describe("rangeUtil", () => {
|
||||
var info = rangeUtil.describeTextRange('now/w');
|
||||
expect(info.display).to.be('This week so far');
|
||||
});
|
||||
|
||||
it('should handle now/M', () => {
|
||||
var info = rangeUtil.describeTextRange('now/M');
|
||||
expect(info.display).to.be('This month so far');
|
||||
});
|
||||
|
||||
it('should handle now/y', () => {
|
||||
var info = rangeUtil.describeTextRange('now/y');
|
||||
expect(info.display).to.be('This year so far');
|
||||
});
|
||||
});
|
||||
|
||||
describe("Can get date range described", () => {
|
||||
|
||||
Reference in New Issue
Block a user