Parses relative datetimes, given an input string and datetime:
iex> {:ok, datetime} = RelativeDateTime.parse("3 days ago", ~U[2018-01-01 00:00:00Z])
{:ok, ~U[2018-12-29 00:00:00Z]}
If available in Hex, the package can be installed
by adding relative_datetime
to your list of dependencies in mix.exs
:
def deps do
[
{:relative_datetime, "~> 0.0.0"}
]
end
Documentation can be generated with ExDoc and published on HexDocs. Once published, the docs can be found at https://hexdocs.pm/relative_datetime.