Function

parseTimecode

Parses flexible editable timecode text into seconds. Accepts plain seconds, decimal seconds, `m:ss`, `m:ss.cc`, `h:mm:ss`, `h:mm:ss.cc`, flexible single-digit colon segments such as `1:2`, and unit suffixes like `s` (seconds), `ms` (milliseconds), `m` (minutes), or `f` (frames, which requires a `frameRate` option). Invalid, negative, missing, or out-of-range user text returns `null`. Invalid developer options such as unsupported drop-frame rates throw `RangeError`.

Signature

Type Definition
parseTimecode(value: string, options: TimecodeParseOptions = {}): number | null

Parameters

NameTypeDescription
valuestringUser-entered timecode text.
optionsTimecodeParseOptionsOptional rounding and frame-rate settings.

Returns

number | null

Parsed seconds with the requested rounding, or `null` when invalid.