You could cache the page itself or even the article itself (I'm not talking about browser cache, I'm talking about caching on the web server).
The idea being that you don't have to keep rendering or even hitting your DB for the content you just have a html fragment that you create once and cache and then serve. You'll only need to rebuild the content when the date expires so when "one year ago" becomes "two years ago" .
javascript:(function () { document.querySelectorAll("relative-time").forEach(function (el) { var p = el.parentNode; var t = el.title; var s = document.createElement("span"); s.innerHTML = t; p.removeChild(el); p.appendChild(s); }); })();
javascript:(()=> {document.querySelectorAll("relative-time").forEach((el)=> el.format="datetime")})()
based on docs at https://github.com/github/relative-time-element
you can also do other formats like
document.querySelectorAll("relative-time").forEach((el)=> {el.format= "datetime"; el.year ="numeric"; el.weekday=undefined;})
document.querySelectorAll("relative-time").forEach((el)=>el.replaceWith(document.createElement("span").innerHTML = el.title))
it hinders fast viewing of the data, when it is more than a small amount.
With 1 hour/week/month/year you cannot go the other way, it is too vague.
But web pages and apps should provide a quick and easy way of changing between the too formats.
For you. For some, you should not need to hover over exact dates to get humanized relative deltas.
/jk
humans from long back, could, and still very much can, easily parse / grok those exact dates and do the trivial date arithmetic needed (just mentally, without even pen and paper, forget a calculator), in seconds, to figure out the deltas nearly perfectly, or at least close enough for their needs.
just because you cannot do it, don't think that plenty of others cannot (analogous to what you said to me above). I have interacted with different types and categories of people, of various educational levels and socio-economic backgrounds, from so-called "low" to so-called quite "high", for many years now, and I can tell you that even uneducated farmers, fishermen, bike and car mechanics, and other kinds of manual labourers that I have met and interacted with a good amount, can easily do these kind of calculations in just a few seconds, mentally. not necessarily all, but many of them can.
And actually, if I saw the date of “2023-12-07,” knowing it was last December actually gives me more information than “eight months ago” — because I know that means around Christmas time last year, and I know what other things happened last December, such as what features we were launching, who the product manager was at the time, etc. If you just shouted a random number of months ago, I would then have to stop and think about the answers to those questions. Lots of my memories could be placed in an approximate month or at least a season, and those never change after the fact. Relative dates are constantly changing and my memory does not increment all its records every month (e.g. “I’ve now worked here 9 months. I’ve now worked here 10 months.” But I can tell you the month and the year I started working here.)
Relative dates are definitely a case of “just because we can do this doesn’t mean we should force everyone to use it”
It feels like the categories are:
"Today, Yesterday, This Week, This Month, Last Year, Big Bang"
https://addons.mozilla.org/en-US/firefox/addon/yyyy-mm-dd-gi...