Skip to main content

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 popular ms package with support for multiple inputs, localization, and more options.

Why Enhanced MS?

While the original ms 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:
FeatureEnhanced MSmspretty-msitty-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)
You can help by adding support for more languages. Make a pull request here.

Get started

Installation

Install Enhanced MS using npm, pnpm, or yarn

Quick start

Get up and running with your first duration conversion

Build docs developers (and LLMs) love