فهرست منبع

fix(timepicker): fixed displaying of customk time ranges, #2861

Torkel Ödegaard 10 سال پیش
والد
کامیت
7dc923a292
2فایلهای تغییر یافته به همراه6 افزوده شده و 1 حذف شده
  1. 1 1
      public/app/core/utils/rangeutil.ts
  2. 5 0
      public/test/specs/core/utils/rangeutil_specs.ts

+ 1 - 1
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;
     }
 

+ 5 - 0
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')