timeago.js
timeago.js is a lightweight JavaScript library under 2 KB that formats dates and timestamps into relative time statements like "3 hours ago" or "in 2 days." It supports both past and future time formatting and is compatible with Node.js and browsers. Key features include internationalization support with built-in locales for English and Chinese, real-time DOM rendering for elements with datetime attributes, and customizable options for relative date and update intervals. The library exposes four main APIs: format for converting dates to time-ago strings, render for automatic real-time DOM updates, cancel to stop rendering tasks, and register for adding custom locales. It can be installed via npm or loaded through a CDN script tag, making it easy to integrate into web projects for displaying dynamic timestamps in a user-friendly way.