Function

formatTimecode

Formats seconds for flexible editable timecode text. Decimal formats are rounded to centiseconds and clamped at zero. Non-finite values are treated as zero. Frame formats round to the nearest frame for the supplied frame rate.

Signature

Type Definition
formatTimecode(seconds: number, options: TimecodeFormatOptions = {}): string

Parameters

NameTypeDescription
secondsnumberDecimal seconds to format.
optionsTimecodeFormatOptionsOptional output shape and frame-rate settings.

Returns

string

Timecode text suitable for timeline UI.

Examples

ts Example
formatTimecode(90.5); // "1:30.50"
formatTimecode(90.5, { frameRate: 24 }); // "00:01:30:12"
formatTimecode(60.06, { frameRate: { numerator: 30000, denominator: 1001 }, dropFrame: true }); // "00:01:00;02"