Macaw.Data.Format.Time (macaw_data v0.18.0)
View SourceA time's format (spec/05 §5): a strftime pattern read once into data, written by
Macaw.Data.Format.time/2.
The pattern is held as its runs: the directives Calendar.strftime/3 has, with the
text between them, as one pattern each, and the directives it lacks or writes otherwise
(%L, %U, %p, %w, %Z and %z) one by one. A % before a character that is no directive is text, as
is a % that ends the pattern.
iex> {:ok, format} = Macaw.Data.Format.parse_time("%H:%M:%S.%L %Z")
iex> format.parts
[{:strftime, "%H:%M:%S."}, :L, {:strftime, " "}, :Z]
Summary
Types
@type part() :: {:strftime | :named, String.t()} | :L | :U | :p | :w | :Z | :z
A run of the pattern: one for Calendar.strftime/3, or a directive it lacks.
@type t() :: %Macaw.Data.Format.Time{ locale: Macaw.Data.Format.Locale.t(), parts: [part()], pattern: String.t() }