pretty-ms is a JavaScript utility that converts a duration in milliseconds into a human-readable time string (for example, 1337000000 becomes “15d 11h 23m 20s”). It’s useful for displaying elapsed times or operation durations with options for compact, verbose, colon style, and sub-second formatting.
Project status
- Actively maintained, with recent work including a feature addition in v9.3.0 (adds
subSecondsAsDecimals) and earlier incremental improvements in v9.2.0 and v9.1.0; last upstream push was 2025-11-02, which suggests ongoing repository activity. - Apparent update cadence is irregular but not inactive: v9.1.0 (2024-07-23), v9.2.0 (2024-11-15), then v9.3.0 (2025-09-15), with larger gaps between later updates (roughly 4 months, then about 10 months).
AI summary generated Today
Recent updates
v9.3.0
8 months agov9.3.0 adds a new `subSecondsAsDecimals` option to `pretty-ms`, allowing sub-second durations (for example `900ms`) to be rendered as decimal seconds (for example `0.9s`). The release notes only document this new option, and the code, type definitions, and README are updated consistently to support it.
Featuresv9.2.0
11/15/2024v9.2.0 adds new formatting options to hide larger time units, specifically year related units and seconds. The implementation changes how the library decomposes days into years/days/hours and conditionally skips the seconds rendering path. It also bumps several devDependencies used for the project tooling and updates tests and TypeScript typings accordingly.
Featuresv9.1.0
7/23/2024v9.1.0 adds support for formatting negative millisecond values in pretty-ms. The main code change is in index.js, where negative inputs are detected and a sign is preserved while the absolute value is formatted. Release notes only mention negative milliseconds support, but the diff also includes CI and dev tool updates.
Featuresv9.0.0
1/18/2024pretty-ms v9.0.0 requires Node.js 18 and adds support for passing BigInt values as the milliseconds input. The implementation also adjusts formatting logic to better handle large values (notably around sub-units and seconds rendering).
BreakingFeaturesv8.0.0
6/6/2022v8.0.0 converts pretty-ms to a pure ESM package and raises the minimum supported Node.js version to Node 14. The code diff also shows TypeScript type definition reshaping and a major dependency bump (parse-ms), alongside the ESM packaging changes.
Breakingv7.0.1
9/24/2020v7.0.1 addresses an issue with how pretty-ms formats sub-second values when the `colonNotation` option is enabled. The code change adjusts the internal logic that decides when to treat `milliseconds < 1000` as “whole seconds” style output, and new tests cover edge cases around 999ms to 1001ms.
v7.0.0
4/27/2020pretty-ms v7.0.0 changes the core time formatting behavior to always floor time values instead of rounding up. The release notes warn that exact string output may differ if you have strict expectations (for example, in unit tests).
Breakingv6.0.1
3/2/2020v6.0.1 is a small patch release that adjusts how output strings are assembled when the `colonNotation` option is used. The code specifically changes the separator behavior for the `unitCount` pathway so the formatted units are joined without unwanted spacing.
v6.0.0
2/12/2020pretty-ms v6.0.0 raises the minimum supported Node.js version to 10 and removes the approximate tilde prefix (~) from output when using the compact and unitCount options. It also changes milliseconds rounding behavior to fix an inconsistency, including adjustments near minute boundaries.
Breakingv5.1.0
11/22/2019Release v5.1.0 adds a new `colonNotation` option to render durations in a digital-clock style format (for example, `5h 1m 45s` becomes `5:01:45`). The code implements this by introducing colon-specific formatting logic and overriding several existing formatting options when `colonNotation` is enabled.
Features