Spectral.Codec.Date (Spectral v0.17.0)

Copy Markdown View Source

Built-in codec for Date.t().

Encodes Date structs to ISO 8601 strings (e.g. "2023-04-01") and decodes them back. Handles :json and :binary_string formats (returning a binary string) and :string format (returning a charlist).

Registration

Registered automatically when the :spectral application starts. To use a different codec for Date.t(), set it in config :spectra, :codecs; user-configured codecs take precedence over the built-ins.