1

I have just seen this:

enter image description here

Followed by this (after hitting "Cancel"):

enter image description here

One of these information is in contradiction with another.

What is the exact value of timeframe where I can edit my comment? Is it 4 minutes or 5 minutes?

I was always more that sure that first value (4 minutes), but the first message has surprised me.

2
  • 11
    "One of these information is in contradiction with another." or the "4 mins ago" is just wrong. The timestamps don't update in real time. Only once in a while.
    – VLAZ
    Commented May 6 at 12:01
  • 3
    ... which does not change the fact that the two pieces of information are in contradiction. Rather, it explains it. Commented May 6 at 12:41

2 Answers 2

15

It is not a bug, it is by design.

All the "4 mins ago" are handled client-side by a function called updateRelativeDates found in the full.js. That function relies on span elements in the page with a title attribute that holds the initial submit time. That time is used to calculate the difference in seconds between NOW and the submit time.

The updateRelativeDates is called by your browser on an interval, to be precise:

 setInterval(updateRelativeDates, 60000);

so every 60 seconds there will be an update. Note that this interval starts at pageload. It isn't reset or re-initialized once the page is loaded. Posting a comment definitely doesn't reload a page.

Given you can't time your comment to be posted at the exact interval, worst case you're 59 seconds off.

The message "Comments may only be edited for 5 minutes" is send from the server. The server has the exact time a comment got saved and can therefor determine exactly whether the comment is within the 5 minute grace period. It would be nice if the client would call updateRelativeDates on receiving a server error that is caused by an user action and while that would make it less likely you would get the same issue as seen in your screenshot, you can't prevent it 100% without making changes how all relative dates/time work.

tl;dr; The comment edit grace period is still 5 minutes. The server is always right. Your client-side time reporting might be off by 59 seconds.

2
  • If -- as you have finally corrected me -- it is "5 minutes edit window" then why we cannot have a 2-3 lines of additional client-side code that would trigger comment's timestamp field to be updated right after displaying "Comments may only be edited for 5 minutes" message? That wouldn't cost much (in both developing it and adding some load to the server) and would shave off all the doubts and misunderstandings, as per my opinion.
    – trejder
    Commented May 7 at 14:31
  • 1
    Yeah, there is many low-hanging fruit to implement by the dev team. Unfortunately they are not given the time by top level management to spend time on these type of UX improvements.
    – rene
    Commented May 7 at 14:54
8

Enter image description here

It goes back to way back. That said, Stack Exchange was always very obsessive with performance and constantly updating timestamps would probably have caused a lot of un-needed traffic.

It isn't contradictory; it’s just that the timestamp isn't updated on the comment, but when you try to edit, it checks the timestamp to make sure you didn't exceed that 5 minute grace period.

2
  • How does it cause "a lot of unneeded traffic"? It could be updated in real time purely client side.
    – user153011
    Commented May 6 at 23:38
  • I don't know about the current devs (mainly cause their quiet) but I'd seen Nick literally talk about shaving milliseconds off on twitter. As for the actual technical details, as opposed to historical context and memes, I think rene's answer covers that better and is worth an upvote ;) Commented May 6 at 23:46

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .