Spectral.Codec.DateTime (Spectral v0.17.0)

Copy Markdown View Source

Built-in codec for DateTime.t().

Encodes DateTime structs to ISO 8601 / RFC 3339 strings (e.g. "2012-04-23T18:25:43.511Z") 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 DateTime.t(), set it in config :spectra, :codecs; user-configured codecs take precedence over the built-ins.