MinecraftStats
MinecraftStats copied to clipboard
"Last Online" time isn't localized
It appears the "Last Online" time in the players list (and other places) isn't localized and is stuck to UTC. This is inconsistent with the rest of the app as the "Last Update" time in the top right is localized.
By localized, you mean the time zone? Because the language is adapted. All times should be in the same time zone as the server, I'm not aware I'm doing any time zone transformation in the web client at all. But I will check and make sure, it would be good to have all times in the client time zone.
This is my stats site. It was updated on July 23, 2021 at 07:27 my local time (confirmed because I know when I updated it) (My local time zone is GMT-5). I'm also on the "Players" tab and if you notice the time that the player was last online was after the stats were updated indicating that the times of "last online" are not the client's time zone. Also there's a 24:48 in there??? what?
Also there's a 24:48 in there??? what?
Ugh. I have a feeling that this stuff may be the source of the issue, but I'll have to look into it. Thanks for reporting! Are you viewing the site in English or some other language?
Note to self: I'm using the standard toLocaleTimeString
function to produce both time displays (last update and last online of players), no further calculations for either of them. Either there's some strange bug in the JavaScript engine or my understanding of something is very wrong.
I could still never reproduce this or find out what is causing this, and within almost 2 years, nobody else ever reported this. I assume it must have been / be an issue with the browser's JavaScript engine, and there's nothing I could do about it anyway. Therefore, I am closing this for now.
Ironically, this popped up again 2 days after closing.
I found out more about the "24:48" time given by toLocaleTimeString
. Apparently, there are differences between browsers. In essence, it seems that the hourCycle
option should be given to it explicitly with value h23
. However, I'll have to check whether this would force a 24-hour format even for English browsers, who'd probably prefer the 12-hour AM/PM format.
Looks like in the past 20 years, date and time APIs have not improved one bit ...