Building out game schedule HTML and Javascript, small CSS changes

This commit is contained in:
Frank Delaguila
2022-10-05 00:23:51 -06:00
parent 35db237c6f
commit ee2beb2769
5 changed files with 105 additions and 30 deletions

View File

@@ -103,11 +103,22 @@ puppeteer
// }
dates.forEach( (date, index) => {
let key = opponents[index].textContent.replace( /([([)0-9^\s])/g, '' ).toLowerCase().trim();
const gameDate = new Date(date.textContent);
let currentDate = new Date();
var dd = String(currentDate.getDate()).padStart(2, '0');
var mm = String(currentDate.getMonth() + 1).padStart(2, '0'); //January is 0!
var yyyy = currentDate.getFullYear();
currentDate = new Date(`${mm} ${dd}, ${yyyy}`);
team.games.push({
opponent: key,
date: date.textContent,
utah_score: utah_score[index].textContent !== '' ? Number(utah_score[index].textContent) : 0,
opponent_points: opponent_points[index].textContent !== '' ? Number(opponent_points[index].textContent) : 0
opponent_points: opponent_points[index].textContent !== '' ? Number(opponent_points[index].textContent) : 0,
win: Number(utah_score[index].textContent) > Number(opponent_points[index].textContent) ? true : false,
gameHappened: currentDate.getTime() > gameDate.getTime()
}
);
} );