@@ -319,6 +319,10 @@ export const createIncidentsChartBars = (incident: Incident, dateArray: SpanDate
319319 const severity = getSeverityName ( groupedData [ i ] [ 2 ] ) ;
320320 const isLastElement = i === groupedData . length - 1 ;
321321
322+ // to avoid certain edge cases the startDate should
323+ // be the minimum between alert.firstTimestamp and groupedData[i][0]
324+ const startDate = Math . min ( incident . firstTimestamp , groupedData [ i ] [ 0 ] ) ;
325+
322326 data . push ( {
323327 y0 : new Date ( groupedData [ i ] [ 0 ] * 1000 ) ,
324328 y : new Date ( groupedData [ i ] [ 1 ] * 1000 ) ,
@@ -328,7 +332,7 @@ export const createIncidentsChartBars = (incident: Incident, dateArray: SpanDate
328332 componentList : incident . componentList || [ ] ,
329333 group_id : incident . group_id ,
330334 nodata : groupedData [ i ] [ 2 ] === 'nodata' ? true : false ,
331- startDate : new Date ( roundTimestampToFiveMinutes ( incident . firstTimestamp ) * 1000 ) ,
335+ startDate : new Date ( roundTimestampToFiveMinutes ( startDate ) * 1000 ) ,
332336 fill :
333337 severity === 'Critical'
334338 ? barChartColorScheme . critical
@@ -387,10 +391,14 @@ export const createAlertsChartBars = (alert: IncidentsDetailsAlert): AlertsChart
387391 for ( let i = 0 ; i < groupedData . length ; i ++ ) {
388392 const isLastElement = i === groupedData . length - 1 ;
389393
394+ // to avoid certain edge cases the startDate should
395+ // be the minimum between alert.firstTimestamp and groupedData[i][0]
396+ const startDate = Math . min ( alert . firstTimestamp , groupedData [ i ] [ 0 ] ) ;
397+
390398 data . push ( {
391399 y0 : new Date ( groupedData [ i ] [ 0 ] * 1000 ) ,
392400 y : new Date ( groupedData [ i ] [ 1 ] * 1000 ) ,
393- startDate : new Date ( roundTimestampToFiveMinutes ( alert . firstTimestamp ) * 1000 ) ,
401+ startDate : new Date ( roundTimestampToFiveMinutes ( startDate ) * 1000 ) ,
394402 x : alert . x ,
395403 severity : alert . severity [ 0 ] . toUpperCase ( ) + alert . severity . slice ( 1 ) ,
396404 name : alert . alertname ,
0 commit comments