62

I just spent an hour debugging my company's web app. More specifically, I was trying to fix a bug that made a label on a comment I just made say "Posted 3 days ago".

After confirming timestamps on the server are correct with a calculator, fiddling around with the js debugger, and ruling out weird timezone-related shenanigans, I came to a conclusion.

The bug was in fact sitting, quite comfortably, between the chair and the keyboard.

Yesterday I had moved the date on my computer roughly 3 days into the future, because I was testing out some unrelated code that was dealing with Redis, and I wanted to expire all of the keys stored inside of it.

Don't blame me, my parents told me I had fallen onto my head as a child.

Comments
  • 4
    I wouldn't have thought that would have caused that issue. The time stamp is normally dependant in the server time is it not?
  • 11
    @SSDD It's generated and stored server side. However, the client doesn't get a relative time (e.g. "x days ago") from the server, but a unix epoch timestamp, which the client is responsible to decode and convert into a relative one. If this timestamp however is in the past from the view of the client (as the client lives three days in the future), it will display something odd like that.
  • 2
    Ok thanks for that. I've just written something that handles this and I did it all server side.
  • 1
    @SSDD It is definitely possible and more convenient as you don't have to care about other timezones or wrong date/time settings on the client, however sometimes it makes more sense to render it on the client side.
  • 2
    This was a cool mystery story. Almost scary. I like the fact that in reality you were the culprit. Man, what a plot twist.
Add Comment