HumanTime (human_time v0.1.0)
A module to convert time intervals into human-readable strings.
Summary
Functions
Converts a duration (in milliseconds or DateTime) into a human-readable string.
Functions
@spec human(integer() | DateTime.t()) :: <<_::32, _::_*8>>
Converts a duration (in milliseconds or DateTime) into a human-readable string.
Examples
iex> HumanTime.human(754000)
"12 minutes from now"
iex> HumanTime.human(-754000)
"12 minutes ago"
iex> HumanTime.human(DateTime.utc_now() |> DateTime.add(5, :second))
"5 seconds from now"
iex> HumanTime.human(DateTime.utc_now() |> DateTime.add(-5, :second))
"5 seconds ago"