Skip to content

Duration

Duration = Brand<"Duration", number>

Defined in: Types/Duration.ts:16

A branded nominal type representing a duration of time in milliseconds. Use Duration to ensure safe time-based operators and clear unit conversions.

const halfSecond = Duration.milliseconds(500);
const twoSeconds = Duration.seconds(2);
const total = pipe(halfSecond, Duration.add(twoSeconds));

Duration.toSeconds(total); // 2.5