Closed PJNorrisS1 closed 5 months ago
From what I can tell, the current code should already do that. Did we add it and not close this request? The timer seems to be set for timercount
, which runs in a few javascript files home.js
, history.js
, summary.js
, and teams.js
. Aside from good practice being we should not be duplicating that code, it does appear they're all implementing something this:
var days = Math.max(0,Math.floor((distance) / (1000 * 60 * 60 * 24)));
var hours = Math.max(0,Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60)));
var minutes = Math.max(0,Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60)));
var seconds = Math.max(0,Math.floor((distance % (1000 * 60)) / 1000));
// Display the result in the element with id="timercount"
var timercount = padDigits(minutes,2) + "m " + padDigits(seconds,2) + "s ";
if (hours > 0) {
timercount = hours + "h " + timercount;
}
if (days > 0) {
timercount = days + "d " + timercount;
}
$("#timercount" + id).text(timercount);
Yeah, looks like @sdoliner got it in https://github.com/moloch--/RootTheBox/commit/41b921e855cfb827db23c9151e3f7b82fa78ea40
Is it possible to define the time in to days, hours and minutes, instead of just minutes? We have scenarios where we like to leave the game running for a couple of days and then stop.