# `Spectral.Codec.Time`
[🔗](https://github.com/andreashasse/spectral/blob/main/lib/spectral/codec/time.ex#L1)

Built-in codec for `Time.t()`.

Encodes `Time` structs to ISO 8601 strings without an offset
(e.g. `"12:30:00"`) and decodes them back. Handles `:json` and
`:binary_string` formats (returning a binary string) and `:string` format
(returning a charlist).

The schema is a `string` with a `pattern`, not `format: "time"`: JSON
Schema's `time` format is RFC 3339 `full-time`, which requires an offset,
and a `Time` has none.

## Registration

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

---

*Consult [api-reference.md](api-reference.md) for complete listing*
