Want.Date (want v1.8.1)

Provides conversions to and from Elixir Date structs.

Link to this section Summary

Functions

Cast a value to an date.

Link to this section Types

Specs

result() ::
  {:ok, %Date{calendar: term(), day: term(), month: term(), year: term()}}
  | {:error, binary()}

Link to this section Functions

Specs

cast(value :: any()) :: result()

Cast a value to an date.

Options

  • :decode - If set to :uri, executes a URI decode on the input value before casting it.

Examples

iex> Want.Date.cast("2022-03-04") {:ok, %Date{year: 2022, month: 03, day: 04}}

Link to this function

cast(input, opts)

Specs

cast(input :: any(), opts :: Keyword.t()) :: result()