Analysis updated 2026-06-26
Set cache expiry or JWT token lifetimes using readable strings like '7 days' instead of raw millisecond numbers.
Define timeout values in backend config with strings like '30s' or '1h' that any developer can understand at a glance.
Convert raw millisecond durations to compact human-readable strings like '2h' for display in a UI.
| vercel/ms | snyk/cli | valor-software/ngx-bootstrap | |
|---|---|---|---|
| Stars | 5,527 | 5,529 | 5,525 |
| Language | TypeScript | TypeScript | TypeScript |
| Setup difficulty | easy | moderate | easy |
| Complexity | 1/5 | 2/5 | 2/5 |
| Audience | developer | ops devops | developer |
Figures from each repo's GitHub metadata at analysis time.
ms is a small JavaScript and TypeScript utility for converting time durations between human-readable strings and raw millisecond numbers. You give it a string like "2 days" or "10h" and it returns the equivalent number of milliseconds. You can also go the other direction: give it a number of milliseconds and it returns a compact string like "1m" or "2h". The library understands a wide range of input formats. You can write durations in full words like "2 minutes", abbreviated forms like "2m", or plain numbers. Capitalization and spacing variations are all accepted. Negative durations are supported too. It is maintained by Vercel and is designed to be tiny, with no dependencies. It works in web browsers, in Node.js, and in newer JavaScript runtimes. The package has TypeScript type definitions built in, and since version 3.0 uses advanced TypeScript features to catch mistakes at compile time if you pass a string the library does not recognize. Installation is a single line with any common JavaScript package manager. The library is widely used in JavaScript projects wherever a readable way to express time durations is needed, such as setting cache expiry times, timeouts, or rate limits.
ms is a tiny JavaScript and TypeScript utility that converts human-readable time strings like '2 days' or '10h' to milliseconds and back, with no dependencies and built-in TypeScript type safety.
Mainly TypeScript. The stack also includes TypeScript, JavaScript, Node.js.
Setup difficulty is rated easy, with roughly 5min to a first successful run.
Mainly developer.
This repo across BitVibe Labs
Verify against the repo before relying on details.