@darija/humanize-duration is a small npm package that formats durations in Moroccan Darija.
It started as an internal piece of logic inside Darija DEV, then got extracted into a standalone package so it can be reused anywhere: apps, websites, bots, or backend services.
The package is built on top of humanize-duration, but it ships with Darija translations and defaults out of the box.
Install
npm install @darija/humanize-duration
Usage
import humanizeDuration from "@darija/humanize-duration";
humanizeDuration(2 * 60 * 60 * 1000);
// "ساعتاين"
humanizeDuration(2 * 24 * 60 * 60 * 1000 + 3 * 60 * 60 * 1000);
// "يوماين و 3 د السوايع"
humanizeDuration(3_000, { units: ["s"], largest: 1 });
// "3 د الثواني"
Why I made it
Darija still has very little reusable tooling in the JavaScript ecosystem. This package is a small step toward making Moroccan Darija easier to support in real products.
Instead of keeping this logic buried inside one codebase, it now lives as a public package anyone can install and build on.
Links
- npm: @darija/humanize-duration
- repo: darija-ma/packages