Give relative timestamps a live feeling

“5 days ago” I implemented a “live update” for relative timestamps. Well as you all might understand, the “5 days ago” might need updating tomorrow.

Now what I found very annoying is, that when you just uploaded a file, it shows “seconds ago”. But if you now leave the browser window open for some time, it will still say “seconds ago”, although it might be hours ago already.

So I implemented a update mechanism for such things. I made the thing very general, so apps can use it aswell. Requirements:

  • Object has class live-relative-timestamp
  • Milliseconds timestamp is in attribute data-timestamp
  • Then the text() of the object is updated every 30 seconds.

Multiple examples are in https://github.com/nextcloud/server/pull/1215 and https://github.com/nextcloud/activity/pull/38

Would be nice, if you check your app for relative dates and in case you have one, update it as well.

6 Likes

Ditto :wink: