formatTime
Given a duration expressed as milliseconds, it returns the duration formatted as an hms string.
Presentation
function formatTime (
milliseconds: number,
as: "time" | "extended-time" | "full-time",
dropBlankUnits: boolean = true,
): string;
Returns
string
-The formatted duration.
Parameters
Name | Type | Description |
---|---|---|
milliseconds | number | @param milliseconds The number of milliseconds. |
as | "time" | "extended-time" | "full-time" | @param as Whether to format it as a time (i.e. "4h 5m 29s") or an extended time (i.e. "4 hours 5 minutes 29 seconds"). |
dropBlankUnits | boolean | @param dropBlankUnits Whether to drop leading and trailing blank units. |