A day.js plugin that formats dates like Twitter (e.g., 'Now', '10s', '1m', '23h', 'Aug 28', 'Aug 28, 2018'). Version 0.5.0 (stable). Lightweight, localized (supports multiple languages), and extends day.js via the plugin system. Different from similar tools like moment-twitter by being day.js-specific and smaller. Release cadence is low; last update was a few years ago.
npm install dayjs-twitterNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Basic usage: extend dayjs with the plugin and call .twitter() on a dayjs object to get relative time strings.
Ensure dayjs.extend(dayjsTwitter) is called once before usage.
Call the method on a dayjs instance, e.g., dayjs().twitter() or dayjs('2020-01-01').twitter().Set locale via dayjs.locale('es') before using the plugin.Use dayjs version 1.x (currently 1.11.x).
Ensure dayjs.extend(dayjsTwitter) is called after importing the plugin.
Use import dayjsTwitter from 'dayjs-twitter' (no curly braces).
Run npm install dayjs-twitter.