A time's format (spec/01 §5): a strftime pattern read once into data, written by
Macaw.Format.time/2.
The pattern is compiled when the format is made, into its parts: each run of text
between directives as one binary, and each directive as an atom, or a tuple carrying
the locale's names it writes. Writing a value walks the parts, so a value never reads
the pattern again (#335). A % before a character that is no directive is text, as is
a % that ends the pattern.
iex> {:ok, format} = Macaw.Format.parse_time("%H:%M:%S.%L %Z")
iex> format.parts
[:H, ":", :M, ":", :S, ".", :L, " ", :Z]The directives Calendar.strftime/3 has are written as it writes them, given the
locale's names, byte for byte; %L, %U, %w, %Z, %z and %p as visualize does.
Summary
Types
@type part() :: String.t() | :Y | :y | :m | :d | :e | :j | :H | :I | :M | :S | :L | :U | :w | :Z | :z | {:a | :A | :b | :B, tuple()} | {:p, String.t(), String.t()}
A part of the compiled pattern: its text, a directive, or a directive with the locale's names it writes (weekdays from Sunday, months from January, the two periods).
@type t() :: %Macaw.Format.Time{ locale: Macaw.Format.Locale.t(), parts: [part()], pattern: String.t() }