mirror of
https://github.com/OneUptime/oneuptime
synced 2024-11-22 15:24:55 +00:00
refactor: Improve calculation of incident duration in IncidentView component
This commit is contained in:
parent
f35e50bab3
commit
8a4afe992c
@ -870,7 +870,7 @@ export default class OneUptimeDate {
|
||||
formattedString += hours + ' hours';
|
||||
}
|
||||
|
||||
if (mins > 0) {
|
||||
if (mins >= 0) {
|
||||
if (formattedString.length > 0) {
|
||||
formattedString += ', ';
|
||||
}
|
||||
|
@ -154,16 +154,34 @@ const IncidentView: FunctionComponent<PageComponentProps> = (
|
||||
}
|
||||
)?.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
|
||||
)
|
||||
);
|
||||
|
Loading…
Reference in New Issue
Block a user