Skip to content

Commit 7dc923a

Browse files
committed
fix(timepicker): fixed displaying of customk time ranges, grafana#2861
1 parent f0f791d commit 7dc923a

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

public/app/core/utils/rangeutil.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ _.each(rangeOptions, function (frame) {
106106
}
107107
}
108108
} else {
109-
opt.display = 'parse error';
109+
opt.display = opt.from + ' to ' + opt.to;
110110
opt.invalid = true;
111111
}
112112

public/test/specs/core/utils/rangeutil_specs.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,11 @@ describe("rangeUtil", () => {
5656
expect(text).to.be('Last 1 hour')
5757
});
5858

59+
it('Date range with rounding ranges', () => {
60+
var text = rangeUtil.describeTimeRange({from: 'now/d+6h', to: 'now'});
61+
expect(text).to.be('now/d+6h to now')
62+
});
63+
5964
it('Date range with absolute to now', () => {
6065
var text = rangeUtil.describeTimeRange({from: moment([2014,10,10,2,3,4]), to: 'now'});
6166
expect(text).to.be('Nov 10, 2014 02:03:04 to a few seconds ago')

0 commit comments

Comments
 (0)