GitShow/sindresorhus/pretty-ms
sindresorhus

pretty-ms

Convert milliseconds to a human readable string: `1337000000` → `15d 11h 23m 20s`

by sindresorhus
humanizemillisecondsnpm-package
Star on GitHubForknpm

JavaScript

1.2k stars66 forks22 contributorsActive · 3h agoSince 2014v9.3.0MIT

Meet the team

See all 22 on GitHub →
sindresorhus
sindresorhus66 contributions
fisker
fisker4 contributions
icyflame
icyflame3 contributions
villebro
villebro3 contributions
arnellebalane
arnellebalane2 contributions
Richienb
Richienb2 contributions
kevva
kevva2 contributions
ehmicky
ehmicky1 contribution

Languages

View on GitHub →
JavaScript96.2%
TypeScript3.8%

Commit activity

Last 12 weeks · 0 commits

Full graph →

Community health

4 of 6 standards met

Community profile →
85
✓README✓License✓Contributing✓Code of Conduct○Issue Template○PR Template

Recent fixes

View closed PRs →
TomerAberbach
Formatted difference inconsistent with formatted endpoints: `prettyMilliseconds(b − a)` vs `prettyMilliseconds(a)` and `prettyMilliseconds(b)`ClosedIssue

I have the following situation: 1. I have and 2. I display , , and to the end-user 3. The result looks wrong because (conceptually) does not equal (due to rounding) Example: Wondering how you'd suggest to handle this? One idea: expose the rounded numeric value alongside the string (e.g. a -style API, or output), so callers can compute the delta from the values as displayed instead of from the raw inputs. Alternatively, an option to format a set of related values consistently (shared unit and precision). The same issue happens in .

TomerAberbach · 3h ago
suryaashish-tyke
Feature Request: add support for monthsClosedIssue

Suppose if the actual age is 54days can we show it as 1mo24d

suryaashish-tyke · 8mo ago
ulken
Option to output sub-second as decimal secondsClosedIssue

@sindresorhus Would you accept a PR that takes an option to keep the decimals on whole numbers? I'm using this library for a progress indicator thingy which keeps updating the time spent every ~60ms or so, and it keeps flickering in the terminal when it hits a whole number - I'd prefer if it just kept the fixed length as specified. @sindresorhus For the same reason, I would find it preferable if sub-seconds could be output as seconds. I.e. -> . Right now I'm wrapping and adding the logic myself, but does it qualify for an option to be included in the library? _Originally posted by @ulken in https://github.com/sindresorhus/pretty-ms/issues/20#issuecomment-1825457807_

ulken · 9mo ago
Structured data for AI agents

Repository: sindresorhus/pretty-ms. Description: Convert milliseconds to a human readable string: `1337000000` → `15d 11h 23m 20s` Stars: 1212, Forks: 66. Primary language: JavaScript. Languages: JavaScript (96.2%), TypeScript (3.8%). License: MIT. Topics: humanize, milliseconds, npm-package. Latest release: v9.3.0 (9mo ago). Open PRs: 0, open issues: 0. Last activity: 3h ago. Community health: 85%. Top contributors: sindresorhus, fisker, icyflame, villebro, arnellebalane, Richienb, kevva, ehmicky, OyuNet, Rich-Harris and others.

·@ofershap

Replace github.com with gitshow.dev