From fc0705e87c5a2bb2aa77fe1234d87b2243cfad7a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Wed, 21 Oct 2015 10:59:02 -0400 Subject: [PATCH] fix(elasticsearch): fix for daily pattern when getting index for today, is now using utc, fixes #2913 --- public/app/plugins/datasource/elasticsearch/index_pattern.js | 2 +- .../datasource/elasticsearch/specs/index_pattern_specs.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/public/app/plugins/datasource/elasticsearch/index_pattern.js b/public/app/plugins/datasource/elasticsearch/index_pattern.js index 29ddc9e5741..d565e22c0b6 100644 --- a/public/app/plugins/datasource/elasticsearch/index_pattern.js +++ b/public/app/plugins/datasource/elasticsearch/index_pattern.js @@ -20,7 +20,7 @@ function (_, moment) { IndexPattern.prototype.getIndexForToday = function() { if (this.interval) { - return moment().format(this.pattern); + return moment.utc().format(this.pattern); } else { return this.pattern; } diff --git a/public/app/plugins/datasource/elasticsearch/specs/index_pattern_specs.ts b/public/app/plugins/datasource/elasticsearch/specs/index_pattern_specs.ts index 8f662bb075f..ccebef59a12 100644 --- a/public/app/plugins/datasource/elasticsearch/specs/index_pattern_specs.ts +++ b/public/app/plugins/datasource/elasticsearch/specs/index_pattern_specs.ts @@ -8,7 +8,7 @@ declare var IndexPattern: any; 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() { var pattern = new IndexPattern('[asd-]YYYY.MM.DD', 'Daily'); var expected = 'asd-' + moment().format('YYYY.MM.DD');