Esc

parse

procedureextensionsince 0.36.1Source
  • macOS: parse works on macOS
  • Linux: parse works on Linux
  • Windows: parse works on Windows
  • Wasm: parse works on Wasm

Reads the type's ISO text; Zoned rejects conflicting offsets and accepts bare zone annotations.

Signature

parse :: (
    $T: Type,
    text: string,
    options: Time_Options = .{}
) -> (T, Time_Error)
Example↗
instant, error := parse(Timestamp, "2024-03-10T07:30:00Z");
assert(error.kind == .NONE && instant.seconds == 1710055800);
_, bad := parse(Date, "2024/02-29");
assert(bad.kind == .SYNTAX && bad.offset == 4);

See also