Just realized im dumb

This commit is contained in:
Bingus_Violet 2024-01-25 23:08:44 -06:00
parent be919a0f62
commit 72cc95d175

View file

@ -46,29 +46,21 @@ app.listen(PORT, () => {
function timeFormatter(seconds) { function timeFormatter(seconds) {
seconds = Math.ceil(seconds) seconds = Math.ceil(seconds)
var minutes = 0 var minutes = Math.floor(seconds / 60)
while (seconds > 60) {
seconds -= 60
minutes += 1
}
return `${minutes}:${seconds}` return `${minutes}:${seconds % 60}`
} }
function gameTimeFormatter(seconds) { function gameTimeFormatter(seconds) {
seconds = Math.ceil(seconds) seconds = Math.ceil(seconds)
var minutes = Math.ceil(seconds / 60) var minutes = Math.ceil(seconds / 60)
var hours = 0 var hours = Math.floor(minutes / 60)
if (seconds < 60) { if (seconds < 60) {
return 'Under a minute ago' return 'Under a minute ago'
} else if (minutes < 60) { } else if (minutes < 60) {
return `${minutes} Minutes` return `${minutes} Minutes`
} else { } else {
while (minutes > 60) { return `${hours} hours and ${minutes % 60} minutes`
minutes -= 60
hours += 1
}
return `${hours} hours and ${minutes} minutes`
} }
} }