View Source Want.Date (want v1.17.1)

Provides conversions to and from Elixir Date structs.

Summary

Functions

Cast a value to an date.

Types

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

Functions

@spec 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}}
@spec cast(input :: any(), opts :: Keyword.t()) :: result()