Explorar o código

Fixed time range when using NOW from and to

utkarshcmu %!s(int64=10) %!d(string=hai) anos
pai
achega
509c3dc715
Modificáronse 1 ficheiros con 4 adicións e 4 borrados
  1. 4 4
      public/app/core/utils/rangeutil.ts

+ 4 - 4
public/app/core/utils/rangeutil.ts

@@ -133,12 +133,12 @@ _.each(rangeOptions, function (frame) {
       return from.fromNow() + ' to ' + formatDate(range.to);
     }
 
-    if (!moment.isMoment(range.from) && !moment.isMoment(range.to)) {
-      return formatDate(dateMath.parse(range.from, true)) + ' to ' + formatDate(dateMath.parse(range.to, true));
+    if (range.to.toString() === 'now') {
+      var res = describeTextRange(range.from);
+      return res.display;
     }
 
-    var res = describeTextRange(range.from);
-    return res.display;
+    return range.from.toString() + ' to ' + range.to.toString();
   }
 
 export = {