Fix bug where number of hours early/prelims start before main could be negative

This commit is contained in:
Clarence Chan committed 2024-09-29 13:05:50 -04:00
1 parent 83e0db4c5c
commit 593fcc1349
1 file changed
+2 -2
+2 -2
View File
@@ -52,7 +52,7 @@ async function createICS() {
if (event.prelimsTime) {
let prelimsTime = new Date(parseInt(event.prelimsTime) * 1000);
let hoursAgo = (date - prelimsTime) / 1000 / 60 / 60;
description += ` (${hoursAgo} hrs before Main)`;
if (hoursAgo > 0) description += ` (${hoursAgo} hrs before Main)`;
}
description += `\n--------------------\n${event.prelims.join("\n")}\n`;
}
@@ -63,7 +63,7 @@ async function createICS() {
parseInt(event.earlyPrelimsTime) * 1000
);
let hoursAgo = (date - earlyPrelimsTime) / 1000 / 60 / 60;
description += ` (${hoursAgo} hrs before Main)`;
if (hoursAgo > 0) description += ` (${hoursAgo} hrs before Main)`;
}
description += `\n--------------------\n${event.earlyPrelims.join(
"\n"