NodeBB / NodeBB

Node.js based forum software built for the modern web
https://nodebb.org
GNU General Public License v3.0
14.14k stars 2.78k forks source link

Timestamps for noscript users #11297

Open julianlam opened 1 year ago

julianlam commented 1 year ago

We currently render relative timestamps via the timeago plugin. Users without javascript enabled don't see them, for obvious reasons.

Solutions

  1. Show the ISO date in template, and then swap it out with the relative date, but there would be a flash where the fallback would be visible. Possible to mitigate this via noscript specific scss (we had that at one point, not sure if still around/working)
  2. The timeago span is empty and takes up no space already, maybe just add a <noscript> tag next to it.
    • We would need to replace all timeago spans with a helper, though.
julianlam commented 1 year ago

Solution 2 works fine (<noscript> tag inside of timeago span/a), as the content inside of it gets removed when timeago is rendered.

The only consideration then is that the ISO time string is not actually all that user-friendly, so we'd need to send in a locale string alongside the ISO timestamp.

banaanihillo commented 10 months ago

Subjective, I know, but could we expect GNU LibreJS and/or NoScript users to actually prefer ISO timestamps instead of locale-specific strings that may or may not be a bit of a mess depending on how well your operating system + browser combination actually handles that locale detection? I personally haven't been able to get English/Denmark nor English/Canada to work reliably, so I still see things like "PM" every now and then if there's no freely customizable user-configuration available

julianlam commented 10 months ago

An ISO date while readable for humans, is not meant to be a format digested by humans, but rather a machine... At least this is my understanding.

The assumption here is that a user will have proper local settings so that the local string will be rendered in the correct user preferred format.

If that isn't the case, then the fix would be an adjustment to the OS settings, which I would hope is doable.