Elasticsearch: Fixes localized dates in index pattern (#27351)

Fixes #8403
This commit is contained in:
Domas
2020-09-07 19:27:56 +03:00
committed by GitHub
parent 5402157cb7
commit 9acb99904a
3 changed files with 36 additions and 3 deletions

View File

@@ -9,11 +9,15 @@ const intervalMap: any = {
};
export class IndexPattern {
private dateLocale = 'en';
constructor(private pattern: any, private interval?: string) {}
getIndexForToday() {
if (this.interval) {
return toUtc().format(this.pattern);
return toUtc()
.locale(this.dateLocale)
.format(this.pattern);
} else {
return this.pattern;
}
@@ -35,7 +39,7 @@ export class IndexPattern {
const indexList = [];
while (start.valueOf() <= endEpoch) {
indexList.push(start.format(this.pattern));
indexList.push(start.locale(this.dateLocale).format(this.pattern));
start.add(1, intervalInfo.amount);
}