[openstreetmap/openstreetmap-website] Update relative timestamps dynamically (Issue #6534)
Minh Nguyễn
notifications at github.com
Mon Nov 17 17:03:21 UTC 2025
1ec5 created an issue (openstreetmap/openstreetmap-website#6534)
Sometimes I view a recent changeset (say, within the last few minutes), switch to another tab, and come back to it after several hours or even a couple days. The timestamp on the changeset is still relative to when I loaded the page. There’s no indication that the timestamp has gone stale, so sometimes I get confused for a moment before realizing what’s going on. Then I have to either hover over the tooltip and do some math or reload the page. This is more of a problem for recent timestamps than older ones, which are already less precise to begin with.
Many sites, including GitHub and some newer parts of MediaWiki, include some client-side JavaScript that refreshes each timestamp periodically on a backoff timer. These days, we can implement relative date formatting using the [`Intl.RelativeTimeFormat`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/RelativeTimeFormat) API, which takes a quantity and a unit. Browser implementations of this API are based on CLDR date formats, which differ from rails-i18n translations in some cases. For consistency, as part of this feature, I suggest changing the served page to use absolute date formats and relying on client-side JavaScript to relativize it in the first place.
CLDR has more comprehensive language coverage than rails-i18n but lacks strings for approximate relative dates: https://github.com/openstreetmap/openstreetmap-website/issues/5769#issuecomment-2723097448. I’d suggest that strings like “about 11 years ago” are counterproductive anyways. Users commonly want to know the year of such an old timestamp, but “about 11 years ago” can only tell them the year, give or take a year. Instead, most sites display an absolute date beyond a certain age. For example, GitHub goes from “just now” to “yesterday” to “2 days ago” to “last week” to “Oct 14”. This could address most of the need for absolute dates in #631, though probably not to the extent that moderators would need.
--
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/issues/6534
You are receiving this because you are subscribed to this thread.
Message ID: <openstreetmap/openstreetmap-website/issues/6534 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20251117/2e96d03d/attachment.htm>
More information about the rails-dev
mailing list