mirror of
https://github.com/clarencechaan/ufc-cal.git
synced 2026-10-19 00:38:30 -07:00
Fix bug where number of hours early/prelims start before main could be negative
This commit is contained in:
1 parent
83e0db4c5c
commit
593fcc1349
1 file changed
+2
-2
@@ -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"
|
||||
|
||||
Reference in new issue
Block a user