timeago.js
Timeago.js is a size-sized library under 2 kilobytes that shapes dates with phrases "before" or "inside". It offers structure, internationalization support and real-time DOM processing features that can work in both browser and Node.js environments. The library contains four basic API functions, including format, render, Cancel, and register.
hustcc · Localization & i18n
Common commercial products in this category: Crowdin, Lokalise, Phrase
- You convert date objects, timestamps, or date strings into readable formats such as "3 hours ago".
- You automatically update HTML nodes in real time by matching them with the datetime attribute.
- You define new localization files outside of established languages to the system with the register function.
- ↑ PositiveGitHub Issue
How to handle differing server and client times
“What's the best way of handling when the server and client times differ? For example, if the clients clock is 5 mins behind, it would show 'in 5 minutes' instead of 'just now' which looks wrong. I tried to enter a relative date like `timeago('2016-06-10 12:12:12')`, but after…”
- • NeutralGitHub Issue
Adjust "days"
“I noticed something. If I do `timeago().format(new Date("2017-08-09 18:00"))` (it is 2017-08-11 12:39 right now) I get `1 day ago`. But in human terms, thats wrong. For me it was actually `2 days ago`, even if it weren't 48 hours. If you say 1 day ago I assume that it was…”
My note
Alternative pages
More in: Localization & i18n
- gin-vue-admin★ 25,113 · 3 days ago
- FormatJS★ 14,753 · today
- react-i18next★ 10,062 · 4 days ago
- i18next★ 8,657 · yesterday
- lang★ 7,782 · yesterday
- Lingui★ 5,933 · yesterday