isValidTime
Signature
Section titled “Signature”isValidTime(value: string): booleanReturn true when value is a valid ISO PlainTime string.
- The part before the first annotation must match
plainTime. - Reads RFC 9557 annotations as
Temporal.PlainTime.fromdoes: elective ones ([foo=bar]), a time zone annotation and a calendar annotation are ignored (a time has no calendar), and an unknown critical one ([!foo=bar]) is rejected. - Rejects leap seconds (e.g., “23:59:60”).
- Rejects invalid times (e.g., “24:00:00”, “23:60:00”).
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
value | string | ISO PlainTime string |
Returns
Section titled “Returns”boolean indicating validity
Examples
Section titled “Examples”import { isValidTime } from "@northguild/gmt/plain/validate";
isValidTime("12:34:56") // true