relative dates

From IndieWeb
(Redirected from ago)


relative dates are a way of converting absolute date-times like year, month, day, and time into a more human friendly expression of time elapsed like "10 minutes ago" or "4 days ago".

Indieweb Examples

Known shows relative dates on postings. (It uses JS, so the relative dates update while the page is open.)

Bridgy show relative dates on webmentions

Woodwind shows relative dates for posts

webmention.herokuapp.com generates relative dates for webmentions

Brainstorming

From IRC:

  • aaronpk: i think my biggest complaint about relative dates is that it's often ambiguous as to when the thing actually happened. github is probably the worst at this.
    • e.g. http://werd.io/2016/petition-to-rebrand-great-britain-as-lol-britain "a day ago" was this last night? yesterday morning? <24 hours ago? between 24-48 hours ago?
    • "a month ago" is the worst tho. is that last calendar month? what if it's the 1st right now, would something yesterday be shown as a month ago?
    • is it last week? 3 weeks ago? 5 weeks ago?
  • kevinmarks: I think a smart move for relative datetimes would be to never show 1 of anything
    • so 0-119 seconds, 2-119 minutes, 2-47 hours 2-13 days 2-8 weeks, 2-23 months 2- years
    • also solves the plural problem, especially if you use 'now' for <2 seconds
    • 2-199 years 2-9 centuries 2- millennia

Pitfalls

Pitfalls to avoid when supporting relative dates:

Avoid server side relative dates

Computing and rendering relative dates on the server and thus directly in your content may have unintended negative consequences:

  • Misleading archives. If you render relative dates server side then you make archiving worse
    • Archives of your content on the Internet Archive etc. will display an out of date and thus inaccurate relative date.
  • Spurious modification dates and poor caching behavior. If you render relative dates server side then anything checking the content of the page to see if anything has changed will see a different relative date every time and generate spurious deltas, which could also generate spurious HTTP etag headers or if modified since responses

See Also

  • math
  • 2020-12-13 Terence Eden: Making Time More Accessible using the time and abbr elements for relative β€œago” dates:

    … That uses the <abbr> abbreviation element. A sighted reader will see the "1h", a screen reader will read out "One Hour Ago", and someone browsing in text mode will just the "1h".