Introduction to Enhanced MS
Enhanced MS is a flexible library for formatting milliseconds into human-readable durations and vice versa. It’s an enhanced version of the popularms package with support for multiple inputs, localization, and more options.
Why Enhanced MS?
While the originalms package is great, Enhanced MS takes it further by adding powerful features that make working with durations easier and more flexible.
Multiple duration units
Convert complex durations like “3 weeks 4 days” to milliseconds in a single call
Localization support
Format and parse durations in 11+ languages including English, Spanish, German, Russian, and more
Flexible formatting
Choose from presets like short format, colon notation, or customize with granular options
Type safe
Written in TypeScript with full type definitions for a better developer experience
Feature comparison
See how Enhanced MS compares to other popular duration libraries:| Feature | Enhanced MS | ms | pretty-ms | itty-time |
|---|---|---|---|---|
| Convert milliseconds to duration | ✅ | ✅ | ✅ | ✅ |
| Convert milliseconds to multiple duration units | ✅ | ❌ | ❌ | ❌ |
| Convert duration to milliseconds | ✅ | ✅ | ❌ | ✅ |
| Convert multiple duration units to milliseconds | ✅ | ❌ | ❌ | ❌ |
| Localization support | ✅ | ❌ | ❌ | ❌ |
Supported languages
Enhanced MS currently supports 11 languages:- English (en) - default
- German (de)
- Russian (ru)
- Māori (mi)
- Spanish (es)
- Dutch (nl)
- Italian (it)
- French (fr)
- Czech (cs)
- Polish (pl)
- Chinese Simplified (zh-CN)
Get started
Installation
Install Enhanced MS using npm, pnpm, or yarn
Quick start
Get up and running with your first duration conversion