{"id":40809,"library":"dayjs-twitter","title":"dayjs-twitter","description":"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.","status":"active","version":"0.5.0","language":"javascript","source_language":"en","source_url":"git://github.com/freearhey/dayjs-twitter","tags":["javascript","dayjs","twitter","plugin","formatter","date"],"install":[{"cmd":"npm install dayjs-twitter","lang":"bash","label":"npm"},{"cmd":"yarn add dayjs-twitter","lang":"bash","label":"yarn"},{"cmd":"pnpm add dayjs-twitter","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Required peer dependency; the plugin extends dayjs.","package":"dayjs","optional":false}],"imports":[{"note":"Default export (not named). Ensure dayjs is imported and extended.","wrong":"import { dayjsTwitter } from 'dayjs-twitter'","symbol":"dayjsTwitter","correct":"import dayjsTwitter from 'dayjs-twitter'"},{"note":"ESM import is preferred; CommonJS requires default export handling.","wrong":"const dayjs = require('dayjs')","symbol":"dayjs","correct":"import dayjs from 'dayjs'"},{"note":"Must call dayjs.extend() with the plugin, not call plugin directly.","wrong":"dayjsTwitter()","symbol":"dayjs.extend","correct":"dayjs.extend(dayjsTwitter)"}],"quickstart":{"code":"import dayjs from 'dayjs';\nimport dayjsTwitter from 'dayjs-twitter';\n\ndayjs.extend(dayjsTwitter);\n\nconsole.log(dayjs().twitter()); // 'Now'\nconsole.log(dayjs().subtract(10, 'second').twitter()); // '10s'\nconsole.log(dayjs().subtract(1, 'minute').twitter()); // '1m'\nconsole.log(dayjs().subtract(23, 'hour').twitter()); // '23h'\nconsole.log(dayjs().subtract(1, 'day').twitter()); // 'Aug 28'\nconsole.log(dayjs().subtract(1, 'year').twitter()); // 'Aug 28, 2018'","lang":"javascript","description":"Basic usage: extend dayjs with the plugin and call .twitter() on a dayjs object to get relative time strings."},"warnings":[{"fix":"Ensure dayjs.extend(dayjsTwitter) is called once before usage.","message":"dayjs must be imported and extended before calling .twitter().","severity":"gotcha","affected_versions":">=0.1.0"},{"fix":"Call the method on a dayjs instance, e.g., dayjs().twitter() or dayjs('2020-01-01').twitter().","message":"The .twitter() method is only available on dayjs instances, not on the dayjs object itself.","severity":"gotcha","affected_versions":">=0.1.0"},{"fix":"Set locale via dayjs.locale('es') before using the plugin.","message":"Localization: if using a locale other than English, ensure dayjs locale is set before calling .twitter().","severity":"gotcha","affected_versions":">=0.1.0"},{"fix":"Use dayjs version 1.x (currently 1.11.x).","message":"The plugin may not work correctly if dayjs version is not compatible. Test with dayjs 1.x.","severity":"gotcha","affected_versions":">=0.1.0"}],"env_vars":null,"search_vec":"'0.5.0':23 '10s':14 '1m':15 '2018':21 '23h':16 '28':18,20 'ago':61 'aug':17,19 'cadenc':52 'date':9,67 'day.js':5,32,47 'dayj':2,63 'dayjs-twitt':1 'differ':37 'e.g':12 'extend':31 'format':8 'formatt':66 'javascript':62 'languag':29 'last':55 'lightweight':25 'like':10,41 'local':26 'low':54 'moment':43 'moment-twitt':42 'multipl':28 'plugin':6,35,65 'releas':51 'similar':39 'smaller':50 'specif':48 'stabl':24 'support':27 'system':36 'tool':40 'twitter':3,11,44,64 'updat':56 'version':22 'via':33 'year':60","created_at":"2026-06-04T18:49:21.542705+00:00","updated_at":"2026-06-04T18:49:21.542705+00:00","problems":[{"fix":"Ensure dayjs.extend(dayjsTwitter) is called after importing the plugin.","cause":"dayjsTwitter was not extended via dayjs.extend() or was incorrectly imported.","error":"TypeError: dayjs(...).twitter is not a function"},{"fix":"Use import dayjsTwitter from 'dayjs-twitter' (no curly braces).","cause":"Using named import instead of default import.","error":"SyntaxError: The requested module 'dayjs-twitter' does not provide an export named 'default'"},{"fix":"Run npm install dayjs-twitter.","cause":"dayjs-twitter is not installed or not in node_modules.","error":"Module not found: Can't resolve 'dayjs-twitter'"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://github.com/freearhey/dayjs-twitter#readme","github":"git://github.com/freearhey/dayjs-twitter","docs":null,"changelog":null,"pypi":null,"npm":"dayjs-twitter","openapi_spec":null,"status_page":null,"smithery":null,"categories":["productivity"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-04","next_check":"2026-09-02","install_tag":null}}