OptionalinputUnit?: "seconds" | "milliseconds"Unit of scalar inputs and parsed results. Defaults to seconds.
Selects the built-in duration codec.
Optionallocale?: stringBCP 47 locale overriding the formatter default for this operation.
OptionalnegativeDisplay?: NegativeDisplayUses a localized sign or surrounding parentheses for negative values.
OptionalroundingMode?: RoundingModeRounding direction for fractional scalar values. Defaults to halfExpand.
OptionalsignDisplay?: SignDisplayControls when a positive or negative sign is displayed.
Selects scalar, parseable H:MM:SS output. Always required.
import { formatter } from "@neutrium/formatter";
import { parser } from "@neutrium/formatter/parse";
const spec = { kind: "duration", presentation: "elapsed", inputUnit: "milliseconds" } as const;
formatter.format(3661000, spec); // "1:01:01"
parser.parse("1:01:01", spec); // "3661000"
Exact scalar duration displayed as
H:MM:SS, with unbounded total hours.Fractions are rounded to whole seconds using
roundingMode. Scalar inputs and parsed results use seconds by default, or milliseconds withinputUnit. Records and localized component options are rejected. NoIntl.DurationFormatservice is needed. Ranges are unsupported.