From 7dc923a292fa58b162f99947f913c668e65e7e62 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Thu, 1 Oct 2015 16:36:16 +0200 Subject: [PATCH] fix(timepicker): fixed displaying of customk time ranges, #2861 --- public/app/core/utils/rangeutil.ts | 2 +- public/test/specs/core/utils/rangeutil_specs.ts | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/public/app/core/utils/rangeutil.ts b/public/app/core/utils/rangeutil.ts index b87dd4969a1..1e64fcc0061 100644 --- a/public/app/core/utils/rangeutil.ts +++ b/public/app/core/utils/rangeutil.ts @@ -106,7 +106,7 @@ _.each(rangeOptions, function (frame) { } } } else { - opt.display = 'parse error'; + opt.display = opt.from + ' to ' + opt.to; opt.invalid = true; } diff --git a/public/test/specs/core/utils/rangeutil_specs.ts b/public/test/specs/core/utils/rangeutil_specs.ts index 5ff1639a204..8816a15f73d 100644 --- a/public/test/specs/core/utils/rangeutil_specs.ts +++ b/public/test/specs/core/utils/rangeutil_specs.ts @@ -56,6 +56,11 @@ describe("rangeUtil", () => { expect(text).to.be('Last 1 hour') }); + it('Date range with rounding ranges', () => { + var text = rangeUtil.describeTimeRange({from: 'now/d+6h', to: 'now'}); + expect(text).to.be('now/d+6h to now') + }); + it('Date range with absolute to now', () => { var text = rangeUtil.describeTimeRange({from: moment([2014,10,10,2,3,4]), to: 'now'}); expect(text).to.be('Nov 10, 2014 02:03:04 to a few seconds ago')