View Source EDTF (EDTF v1.1.0)

Parse, validate, and humanize EDTF date strings

Summary

Functions

Generate an error response

Humanize an EDTF date string

Identify the open-ended continuation markers on an EDTF date string

Validate an EDTF date string

Functions

Link to this function

error(error \\ :invalid_format)

View Source

Generate an error response

Humanize an EDTF date string

Example:

  iex> humanize("1999-06-10")
  "June 10, 1999"

  iex> humanize("bad date!")
  {:error, :invalid_format}

Identify the open-ended continuation markers on an EDTF date string

Link to this function

parse(edtf, include \\ [Interval, Aggregate, Date])

View Source

Parse an EDTF date string

Example:

  iex> parse("1999-06-10")
  {:ok, %EDTF.Date{level: 0, type: :date, values: [1999, 5, 10]}}

  iex> parse("bad date!")
  {:error, :invalid_format}

Validate an EDTF date string

Example:

  iex> validate("1999-06-10")
  {:ok, "1999-06-10"}

  iex> validate("bad date!")
  {:error, :invalid_format}