Textual Time Period Converter

JSON →
library 3.0.2 ·javascript
verified May 27, 2026

to-time is a JavaScript/TypeScript utility for parsing and converting textual time periods (e.g., "1 hour", "1y 365d 4h") into various standard time units such as milliseconds, seconds, minutes, hours, days, weeks, and years. The current stable version is 3.0.2, with recent minor and patch releases indicating active development. A key differentiator of to-time is its internal reliance on the `bignumber.js` library to perform arithmetic operations, ensuring high precision and mitigating common floating-point inaccuracies often encountered in time calculations. The package supports dual CommonJS and ESM builds through an `exports` map, providing native compatibility for modern Node.js environments (requiring Node.js 20.19+). It also ships with comprehensive TypeScript types, facilitating robust development. The library offers both a primary parsing function and a suite of static factory methods (`fromMilliseconds`, `fromHours`) for initialization, alongside fluent appender methods (`addMinutes`, `addYears`) for manipulating time frames.

total hits 20
actors 8 distinct systems
last hit 1d ago human
GPTBot
5
MetaBot
4
Script
1
Search engines
2
Humans
2

top countries 🇺🇸 United States · 🇨🇦 Canada · 🇫🇷 France · 🇩🇪 Germany · MY