24 hr clock everywhere

Shuri2060

Strategos
Grepolis uses a 24 hr clock on browser, but its format is h:mm:ss instead of hh:mm:ss in some places (eg. command overview, whereas reports is hh:mm:ss).

I think hh:mm:ss is the correct format to show everything is in 24 hrs.

To fix - just change the readableUnixTimestamp function in common.js to the below

(all that is added is this which adds the extra 0 when necessary)

if (hours < 10) {
hours = '0' + hours;​
}


------------------------------------------

function readableUnixTimestamp(timestamp, timezone_type, options) {
options = options === undefined ? {} : options;

var with_seconds = options.with_seconds === undefined ? true : options.with_seconds;
var extended_date = options.extended_date === undefined ? false : options.extended_date;

var ts = (timezone_type === 'no_offset' ? timestamp : Timestamp.shiftUnixTimestampByTimezoneOffset(timestamp, timezone_type));

var date = new Date(ts * 1E3);
var hours, minutes, seconds, days, months;
var result;

hours = date.getUTCHours();
minutes = date.getUTCMinutes();
seconds = date.getUTCSeconds();

if (hours < 10) {
hours = '0' + hours;​
}


if (minutes < 10) {
minutes = '0' + minutes;​
}

if (seconds < 10) {
seconds = '0' + seconds;​
}

if (extended_date) {
days = date.getUTCDate();
months = date.getUTCMonth() + 1;

if (days < 10) {

days = '0' + days;​
}

if (months < 10) {
months = '0' + months;​
}

result = days + '.' + months + '.|' + hours + ':' + minutes + (with_seconds ? (':' + seconds) : '');​
} else {
result = hours + ':' + minutes + (with_seconds ? (':' + seconds) : '');​
}

return result;​
}
 
Top