Hacker News new | ask | show | jobs
by codetrotter 1043 days ago
I recently joined a small online forum from my country. They had some people write the whole thing from scratch more or less.

I happen to be traveling currently.

When I log into the forum from my location, which is one hour away time zone wise from the country the forum is from, and I make a post, I then see the timestamp for my own post presented as “in 59 minutes”.

I reported the bug, but they didn’t fix it yet. I still find it hilarious.

I happen to know that the owner of the forum is planning to go abroad sometime in January. If he does he will surely see this weirdness himself firsthand when he posts to his forum. Maybe then, once he gets to see it himself, a fix will be prioritised :p

1 comments

What would you expect as a fix? How do they know about the timezone you are currently on? Not an easy fix in my opinion as they have to be aware of your timezone (or ask for it) anytime you post
They are rendering the timestamp with JS.

JS has the ability to see system time zone offset.

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...

It’s not difficult to send the time zone in UTC, and convert it client side to local time zone.

And since they do “x minutes ago” kind of things they are certainly using a library. They are probably passing in “naive” timestamps without TZ info into a library that is perfectly able to handle it correctly for them, had they just read the docs for the library they used and taken a moment to make sure that they include TZ info.

And if everything was done server side it would likewise be similarly easy to get it right because then my own time zone does not matter.