ayo, (edited )
@ayo@ayco.io avatar

I'm hesitating from writing a <time-ago> web component for https://ayco.io/threads ... I know the ideal situation is to not calculate the relative time on the server (for more accurate html info, faster response, simpler), and instead I should progressively enhance this on the browser -- I have to do this at some point

cheeaun,
@cheeaun@mastodon.social avatar
ayo,
@ayo@ayco.io avatar

@cheeaun yay it has a precision attribute! 🙌

ayo,
@ayo@ayco.io avatar

gotchas, of course, include that the timezone on the server is likely different than the timezone in the viewer's device -- so I will default to showing by day (just today, yesterday, 2 days ago) instead of by seconds

ayo,
@ayo@ayco.io avatar

thanks @cheeaun for mentioning GitHub's <relative-time> (you saved me twice today already hehe)

repo: https://github.com/github/relative-time-element
demo: https://codepen.io/ayoayco-the-styleful/pen/WNBrpQG

ayo, (edited )
@ayo@ayco.io avatar

https://ayco.io/threads now using GitHub's <relative-time> web component

👉 commit: https://git.sr.ht/~ayoayco/threads/commit/14ce1c0f117c4b9114e580c1c11caac86e7012d4

ayo,
@ayo@ayco.io avatar

Thinking I should write the web-component for my use-case with just the subset of features... I don't need everything, I only need a <days-ago> or something

  • All
  • Subscribed
  • Moderated
  • Favorites
  • random
  • DreamBathrooms
  • mdbf
  • ngwrru68w68
  • magazineikmin
  • thenastyranch
  • rosin
  • khanakhh
  • osvaldo12
  • Youngstown
  • slotface
  • Durango
  • kavyap
  • InstantRegret
  • tacticalgear
  • anitta
  • ethstaker
  • modclub
  • cisconetworking
  • tester
  • GTA5RPClips
  • cubers
  • everett
  • megavids
  • provamag3
  • normalnudes
  • Leos
  • JUstTest
  • lostlight
  • All magazines