Time.ISO

lib/Time/ISO.gob

The pieces of ISO 8601 text that more than one type reads or writes.

Reading is strict: a reader consumes exactly the form asked for, and a type's parse succeeds only if the whole string is consumed. ISO text is ASCII, so the reader works on bytes; a byte outside ASCII simply fails to match.

type Reader
fun reader : fun(String) -> Reader
fun finished : fun(Reader) -> Bool
fun looking : fun(Reader, Char) -> Bool

Whether c is next, without consuming it.

fun skip : fun(Reader) -> Option Unit

Consumes whatever byte is next, if there is one.

fun letter : fun(Reader) -> Bool

Consumes an ASCII letter if one is next.

fun upTo : fun(Reader, Char) -> Option String

The text up to the next c, which is not consumed; None if there is no c, or the text is empty.

fun accept : fun(Reader, Char) -> Bool

Consumes c if it is next.

fun expect : fun(Reader, Char) -> Option Unit
fun sign : fun(Reader) -> Int

An optional + or -: -1 after a minus, otherwise 1.

fun digits : fun(Reader, Int) -> Option Int

Exactly count digits, as a number.

fun someDigits : fun(Reader) -> Option Int

One or more digits, at most 18 so the number cannot overflow.

fun fraction : fun(Reader) -> Option Int

After a . or ,, one to nine digits of a second, as nanoseconds. Absent, it is 0.

fun offset : fun(Reader) -> Option Offset

A UTC offset: Z, or a sign and HH:MM under 24 hours as RFC 3339 writes one, optionally with :SS for the offsets of old local mean times.

fun padded : fun(Int, Int) -> String

n, which is not negative, in at least width digits.

fun year : fun(Int) -> String

A year as ISO 8601 writes it: four digits from 0 to 9999, otherwise a sign and six, the expanded form.

fun fractionText : fun(Int) -> String

. and the nanoseconds without trailing zeros, or nothing for 0.