fix conditional inloop for uptime duration

This commit is contained in:
Alex Holliday
2024-11-05 12:22:48 +08:00
parent 401c3b83fe
commit b5e8bdbdcd
+1 -1
View File
@@ -56,7 +56,7 @@ const calculateUptimeDuration = (checks) => {
const latestCheck = new Date(checks[0].createdAt);
let latestDownCheck = 0;
for (let i = checks.length; i >= 0; i--) {
for (let i = checks.length - 1; i >= 0; i--) {
if (checks[i].status === false) {
latestDownCheck = new Date(checks[i].createdAt);
break;