Skip to main content

durationToMilliseconds()

Home > @backstage/types > durationToMilliseconds

Converts a HumanDuration to milliseconds.

Signature:

function durationToMilliseconds(duration: HumanDuration): number;

Parameters

ParameterTypeDescription
durationHumanDurationA human friendly duration object.

Returns:

number

The number of approximate milliseconds that the duration represents.

Remarks

Note that this conversion by definition is an approximation in the absence of an anchor to a point in time and time zone, as the number of milliseconds is not constant for many units. So the conversion assumes 365-day years, 30-day months, and fixed 24-hour days.