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.

TI

hustcc · Localization & i18n

STARS5.4K
FORKS402
COMMITS0
CONTRIBUTORS0
VERSIONv4.0.2
UPDATED22 days ago
TypeScriptTarih BiçimlendirmeUluslararasılaştırmaDOM İşlemeMIT

Common commercial products in this category: Crowdin, Lokalise, Phrase

What can it do?
  • 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.
User reviews
  • ↑ 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