mirror of
https://github.com/clarencechaan/ufc-cal.git
synced 2026-10-19 00:38:30 -07:00
Change strings to use template literals
This commit is contained in:
1 parent
d8a4e63210
commit
4092a2e2f5
2 files changed
+17
-24
No files matched your search
@@ -42,7 +42,7 @@ async function createICS() {
|
||||
// Distinguish between main card and prelims if this information has been
|
||||
// announced by the UFC, otherwise list all fights without categorizing
|
||||
if (event.fightCard.length)
|
||||
description += event.fightCard.join("\n") + "\n";
|
||||
description = `${event.fightCard.join("\n")}\n`;
|
||||
if (event.mainCard.length)
|
||||
description +=
|
||||
"Main Card\n--------------------\n" +
|
||||
@@ -51,23 +51,22 @@ async function createICS() {
|
||||
if (event.prelims.length) {
|
||||
let prelimsTime = new Date(parseInt(event.prelimsTime) * 1000);
|
||||
let hoursAgo = (date - prelimsTime) / 1000 / 60 / 60;
|
||||
description +=
|
||||
`\nPrelims (${hoursAgo} hrs before Main)\n--------------------\n` +
|
||||
event.prelims.join("\n") +
|
||||
"\n";
|
||||
description += `\nPrelims (${hoursAgo} hrs before Main)\n--------------------\n${event.prelims.join(
|
||||
"\n"
|
||||
)}\n`;
|
||||
}
|
||||
if (event.earlyPrelims.length) {
|
||||
let earlyPrelimsTime = new Date(
|
||||
parseInt(event.earlyPrelimsTime) * 1000
|
||||
);
|
||||
let hoursAgo = (date - earlyPrelimsTime) / 1000 / 60 / 60;
|
||||
description +=
|
||||
`\nEarly Prelims (${hoursAgo} hrs before Main)\n--------------------\n` +
|
||||
event.earlyPrelims.join("\n") +
|
||||
"\n";
|
||||
if (!hoursAgo) console.log("hoursAgo", date, earlyPrelimsTime);
|
||||
description += `\nEarly Prelims (${hoursAgo} hrs before Main)\n--------------------\n${event.earlyPrelims.join(
|
||||
"\n"
|
||||
)}\n`;
|
||||
}
|
||||
description += "\n" + event.url;
|
||||
description += "\n\nAccurate as of " + dateTimestr;
|
||||
description += `\n${event.url}`;
|
||||
description += `\n\nAccurate as of ${dateTimestr}`;
|
||||
|
||||
let location = event.location;
|
||||
let uid = event.url;
|
||||
@@ -87,7 +86,7 @@ async function createICS() {
|
||||
console.log(events);
|
||||
|
||||
// Create UFC.ics
|
||||
writeFileSync(`UFC.ics`, createEvents(events).value);
|
||||
writeFileSync("UFC.ics", createEvents(events).value);
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user