diff --git a/Common/Types/Date.ts b/Common/Types/Date.ts index 463c4525b1..90ad120949 100644 --- a/Common/Types/Date.ts +++ b/Common/Types/Date.ts @@ -870,7 +870,7 @@ export default class OneUptimeDate { formattedString += hours + ' hours'; } - if (mins > 0) { + if (mins >= 0) { if (formattedString.length > 0) { formattedString += ', '; } diff --git a/Dashboard/src/Pages/Incidents/View/Index.tsx b/Dashboard/src/Pages/Incidents/View/Index.tsx index 03efb11917..9807caf70b 100644 --- a/Dashboard/src/Pages/Incidents/View/Index.tsx +++ b/Dashboard/src/Pages/Incidents/View/Index.tsx @@ -154,16 +154,34 @@ const IncidentView: FunctionComponent = ( } )?.startsAt; - if (!acknowledgeTime) { + const resolveTime: Date | undefined = incidentStateTimeline.find( + (timeline: IncidentStateTimeline) => { + return ( + timeline.incidentStateId?.toString() === + getResolvedState()?._id?.toString() + ); + } + )?.startsAt; + + if (!acknowledgeTime && !resolveTime) { return ( 'Not yet ' + (getAcknowledgeState()?.name?.toLowerCase() || 'acknowledged') ); } + if (!acknowledgeTime && resolveTime) { + return OneUptimeDate.convertMinutesToDaysHoursAndMinutes( + OneUptimeDate.getDifferenceInMinutes( + resolveTime, + incidentStartTime + ) + ); + } + return OneUptimeDate.convertMinutesToDaysHoursAndMinutes( OneUptimeDate.getDifferenceInMinutes( - acknowledgeTime, + acknowledgeTime!, incidentStartTime ) );