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.