API Reference

@lukeed/ms

Tiny millisecond conversion library for time strings like "1d" and "2.5h", with parse and format functions.

Official Documentation ↗
CompatibilityThis documentation covers version v2.0. Check the official docs for the latest API surface.

Installation

npmnpm install @lukeed/ms

Methods

@lukeed/ms is tiny millisecond conversion library for time strings like “1d” and “2.5h”, with parse and format functions. This page documents the core methods, installation, and common usage patterns for the current stable release.

Installation

Install @lukeed/ms with your preferred package manager using the command shown in the frontmatter. The package is published to the npm registry and ships with TypeScript types where applicable.

Core methods

The methods listed in the frontmatter cover the primary API surface. Each signature reflects the v2.0 release. Consult the official documentation linked in sourceUrl for advanced options, edge cases, and breaking changes between major versions.

Frequently asked questions

The faq section in the frontmatter answers the most common questions about @lukeed/ms, including comparisons with alternatives, configuration tips, and runtime requirements. If your question is not covered, check the source URL for the full guide.

API reference evidence

Fetched from official sources on 2026-11-08T20:08:00+08:00 via WebFetch https://raw.githubusercontent.com/lukeed/ms/master/readme.md;WebFetch https://raw.githubusercontent.com/lukeed/ms/master/index.d.ts.

FAQ

How is it different from the ms package?
It is ESM-only, smaller, and separates parse and format into named exports.
Does it support long format?
Yes. Pass true as the second arg to format: ms.format(86400000, true) returns "1 day".
Can it parse decimals?
Yes. "1.5h" parses to 5400000 ms.