# `Koyomi.Dates`
[🔗](https://github.com/hattoriai/koyomi/blob/v0.2.1/lib/koyomi/dates.ex#L1)

An Ecto type for a set of days, stored in a `date[]` column (an array
of dates), for the multiple-date picker.

    # The migration
    add :days, {:array, :date}, default: []

    # The schema
    field :days, Koyomi.Dates, default: []

SQLite has no arrays: `ecto_sqlite3` keeps the list in a text column as
a JSON array of ISO dates, which the type reads back the same.

The picker posts the days as a list (`days[]`), with an empty first
entry so that a form with no day selected still posts the field. The
type drops the empty entries, removes repeated days and sorts the rest,
so `["", "2027-03-05", "2027-03-01", "2027-03-05"]` casts to
`[~D[2027-03-01], ~D[2027-03-05]]`. It also casts a list of `Date` and
a comma-separated string.

# `embed_as`

# `equal?`

---

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