Test Average Game Age Fix
This commit is contained in:
parent
08a729e270
commit
c4e0c9371b
|
@ -221,21 +221,22 @@ async function GetAverageGameAge() {
|
||||||
let month = today.getMonth() - averageGameAge.getMonth();
|
let month = today.getMonth() - averageGameAge.getMonth();
|
||||||
let day = today.getDate() - averageGameAge.getDate();
|
let day = today.getDate() - averageGameAge.getDate();
|
||||||
|
|
||||||
if (month < 0) {
|
while (month < 0 || day < 0) {
|
||||||
year--;
|
if (month < 0) {
|
||||||
month += 12;
|
year--;
|
||||||
}
|
month += 12;
|
||||||
|
}
|
||||||
|
|
||||||
if (day < 0) {
|
if (day < 0) {
|
||||||
month--;
|
month--;
|
||||||
const previousMonth = new Date(today.getFullYear(), today.getMonth(), 0);
|
const previousMonth = new Date(today.getFullYear(), today.getMonth(), 0);
|
||||||
day += previousMonth.getDate();
|
day += previousMonth.getDate();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return `${year} years, ${month} months, ${day} days old`;
|
return `${year} years, ${month} months, ${day} days old`;
|
||||||
}
|
}
|
||||||
return '';
|
return ' ';
|
||||||
}
|
}
|
||||||
|
|
||||||
async function GetFavouriteGenres() {
|
async function GetFavouriteGenres() {
|
||||||
|
|
Loading…
Reference in New Issue