Skip to content

Commit

Permalink
specify date format for time split filters (#119504) (#119936)
Browse files Browse the repository at this point in the history
Co-authored-by: Kibana Machine <[email protected]>

Co-authored-by: Joe Reuter <[email protected]>
  • Loading branch information
kibanamachine and flash1293 authored Nov 30, 2021
1 parent 7e0c7b1 commit 31db62f
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/plugins/data/common/search/aggs/agg_configs.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,7 @@ describe('AggConfigs', () => {
"0": Object {
"range": Object {
"@timestamp": Object {
"format": "strict_date_optional_time",
"gte": "2021-05-05T00:00:00.000Z",
"lte": "2021-05-10T00:00:00.000Z",
},
Expand All @@ -368,6 +369,7 @@ describe('AggConfigs', () => {
"86400000": Object {
"range": Object {
"@timestamp": Object {
"format": "strict_date_optional_time",
"gte": "2021-05-04T00:00:00.000Z",
"lte": "2021-05-09T00:00:00.000Z",
},
Expand Down
1 change: 1 addition & 0 deletions src/plugins/data/common/search/aggs/agg_configs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -406,6 +406,7 @@ export class AggConfigs {
.map(([filter, field]) => ({
range: {
[field]: {
format: 'strict_date_optional_time',
gte: moment(filter?.query.range[field].gte).subtract(shift).toISOString(),
lte: moment(filter?.query.range[field].lte).subtract(shift).toISOString(),
},
Expand Down
1 change: 1 addition & 0 deletions src/plugins/data/common/search/aggs/utils/time_splits.ts
Original file line number Diff line number Diff line change
Expand Up @@ -430,6 +430,7 @@ export function insertTimeShiftSplit(
filters[key] = {
range: {
[timeField]: {
format: 'strict_date_optional_time',
gte: moment(timeFilter.query.range[timeField].gte).subtract(shift).toISOString(),
lte: moment(timeFilter.query.range[timeField].lte).subtract(shift).toISOString(),
},
Expand Down

0 comments on commit 31db62f

Please sign in to comment.