Przeglądaj źródła

fix(elasticsearch): fix for daily pattern when getting index for today, is now using utc, fixes #2913

Torkel Ödegaard 10 lat temu
rodzic
commit
fc0705e87c

+ 1 - 1
public/app/plugins/datasource/elasticsearch/index_pattern.js

@@ -20,7 +20,7 @@ function (_, moment) {
 
 
   IndexPattern.prototype.getIndexForToday = function() {
   IndexPattern.prototype.getIndexForToday = function() {
     if (this.interval) {
     if (this.interval) {
-      return moment().format(this.pattern);
+      return moment.utc().format(this.pattern);
     } else {
     } else {
       return this.pattern;
       return this.pattern;
     }
     }

+ 1 - 1
public/app/plugins/datasource/elasticsearch/specs/index_pattern_specs.ts

@@ -8,7 +8,7 @@ declare var IndexPattern: any;
 
 
 describe('IndexPattern', function() {
 describe('IndexPattern', function() {
 
 
-  describe('when getting index for today', function() {
+  describe.only('when getting index for today', function() {
     it('should return correct index name', function() {
     it('should return correct index name', function() {
       var pattern = new IndexPattern('[asd-]YYYY.MM.DD', 'Daily');
       var pattern = new IndexPattern('[asd-]YYYY.MM.DD', 'Daily');
       var expected = 'asd-' + moment().format('YYYY.MM.DD');
       var expected = 'asd-' + moment().format('YYYY.MM.DD');