Skip to content

createTimeOrThrow ​

The createTimeOrThrow() function builds a TheTime from a TheTime, a SerializedTheTime, a numeric value, or a SpoolingTime. It throws CreateTheTimeError when the input is invalid.

Interactive example ​

Syntax ​

typescript
function createTimeOrThrow(
	input: number | TheTime | SpoolingTime | SerializedTheTime
): TheTime

Parameters ​

  • input: A time value (number), a TheTime, a SerializedTheTime, or a SpoolingTime.

Return value ​

A valid TheTime. If the value is out of bounds or inconsistent, a CreateTheTimeError is thrown.

See also ​

Released under the MIT license.