Skip to main content

formatDuration

Formats a travel time with short units, for example "18 min", "1 h 5 min" or "2 d 3 h", as a message to format with the active catalogue. The time is rounded to the minute, and a day or more drops the minutes. Under half a minute, and for a time that is negative or not finite, it reads "Under 1 min".

This is a function exported by @mapcairn/core, checked against version 0.2.0.

Signature​

import { formatDuration } from "@mapcairn/core";

function formatDuration(seconds: number): Message;

Parameters​

  • seconds (number)

Returns​

Message

See also​

Source: packages/core/src/units/duration.ts:48