diff --git a/x-pack/plugins/security_solution/common/endpoint/generate_data.test.ts b/x-pack/plugins/security_solution/common/endpoint/generate_data.test.ts index ff40bc935b9f..644f1d71e19a 100644 --- a/x-pack/plugins/security_solution/common/endpoint/generate_data.test.ts +++ b/x-pack/plugins/security_solution/common/endpoint/generate_data.test.ts @@ -272,16 +272,14 @@ describe('data generator', () => { let startTime = new Date(timestampSafeVersion(tree.allEvents[0]) ?? startOfEpoch); expect(startTime).not.toEqual(startOfEpoch); let endTime = new Date(timestampSafeVersion(tree.allEvents[0]) ?? startOfEpoch); - expect(startTime).not.toEqual(startOfEpoch); + expect(endTime).not.toEqual(startOfEpoch); for (const event of tree.allEvents) { const currentEventTime = new Date(timestampSafeVersion(event) ?? startOfEpoch); expect(currentEventTime).not.toEqual(startOfEpoch); if (currentEventTime < startTime) { startTime = currentEventTime; - } - - if (currentEventTime > endTime) { + } else { endTime = currentEventTime; } } diff --git a/x-pack/plugins/security_solution/common/endpoint/generate_data.ts b/x-pack/plugins/security_solution/common/endpoint/generate_data.ts index 952a74886d32..de8bd83432d1 100644 --- a/x-pack/plugins/security_solution/common/endpoint/generate_data.ts +++ b/x-pack/plugins/security_solution/common/endpoint/generate_data.ts @@ -726,7 +726,7 @@ export class EndpointDocGenerator { if (eventTimestamp !== undefined) { if (eventTimestamp < startTime) { startTime = eventTimestamp; - } else if (eventTimestamp > endTime) { + } else { endTime = eventTimestamp; } }