Skip to content

toTimeValue

The toTimeValue() function converts a TheTime or SerializedTheTime into a numeric value (milliseconds). It applies the makeSafeTimeValue safeguards: rounding decimals and clamping between minTimeValue and maxTimeValue.

Interactive example

Syntax

typescript
function toTimeValue<
	GenericInput extends TheTime | SerializedTheTime
>(
	input: GenericInput
): number

Parameters

  • input: Duration formatted as TheTime or SerializedTheTime.

Return value

The numeric value in milliseconds, clamped to minTimeValue and maxTimeValue.

See also

Released under the MIT license.