@@ -339,6 +339,10 @@ export const createIncidentsChartBars = (incident: Incident, dateArray: SpanDate
339339 const severity = getSeverityName ( groupedData [ i ] [ 2 ] ) ;
340340 const isLastElement = i === groupedData . length - 1 ;
341341
342+ // to avoid certain edge cases the startDate should
343+ // be the minimum between alert.firstTimestamp and groupedData[i][0]
344+ const startDate = Math . min ( incident . firstTimestamp , groupedData [ i ] [ 0 ] ) ;
345+
342346 data . push ( {
343347 y0 : new Date ( groupedData [ i ] [ 0 ] * 1000 ) ,
344348 y : new Date ( groupedData [ i ] [ 1 ] * 1000 ) ,
@@ -348,7 +352,7 @@ export const createIncidentsChartBars = (incident: Incident, dateArray: SpanDate
348352 componentList : incident . componentList || [ ] ,
349353 group_id : incident . group_id ,
350354 nodata : groupedData [ i ] [ 2 ] === 'nodata' ? true : false ,
351- startDate : new Date ( roundTimestampToFiveMinutes ( incident . firstTimestamp ) * 1000 ) ,
355+ startDate : new Date ( roundTimestampToFiveMinutes ( startDate ) * 1000 ) ,
352356 fill :
353357 severity === 'Critical'
354358 ? barChartColorScheme . critical
@@ -407,10 +411,14 @@ export const createAlertsChartBars = (alert: IncidentsDetailsAlert): AlertsChart
407411 for ( let i = 0 ; i < groupedData . length ; i ++ ) {
408412 const isLastElement = i === groupedData . length - 1 ;
409413
414+ // to avoid certain edge cases the startDate should
415+ // be the minimum between alert.firstTimestamp and groupedData[i][0]
416+ const startDate = Math . min ( alert . firstTimestamp , groupedData [ i ] [ 0 ] ) ;
417+
410418 data . push ( {
411419 y0 : new Date ( groupedData [ i ] [ 0 ] * 1000 ) ,
412420 y : new Date ( groupedData [ i ] [ 1 ] * 1000 ) ,
413- startDate : new Date ( roundTimestampToFiveMinutes ( alert . firstTimestamp ) * 1000 ) ,
421+ startDate : new Date ( roundTimestampToFiveMinutes ( startDate ) * 1000 ) ,
414422 x : alert . x ,
415423 severity : alert . severity [ 0 ] . toUpperCase ( ) + alert . severity . slice ( 1 ) ,
416424 name : alert . alertname ,
0 commit comments