TimeAgo v1.0.0 TimeAgo View Source
Module for getting the amount of days/hours/minutes/seconds since past a specific date
Link to this section Summary
Functions
Returns tuple first value is the amount of days/hours/minutes/seconds seconds value is the unit as a atom
Link to this section Functions
Link to this function
from_date(first, last \\ DateTime.utc_now())
View Sourcefrom_date(DateTime.t(), DateTime.t()) :: {number(), atom()}
Returns tuple first value is the amount of days/hours/minutes/seconds seconds value is the unit as a atom
Examples
### original date
iex> TimeAgo.from_date ~N[2019-12-10 23:00:00], ~N[2019-12-21 22:30:00]
{~N[2019-12-10 23:00:00], :date}
### days
iex> TimeAgo.from_date ~N[2019-12-18 12:00:00], ~N[2019-12-21 22:30:00]
{3, :days}
### hours
iex> TimeAgo.from_date ~N[2019-12-21 20:00:00], ~N[2019-12-21 22:30:00]
{2, :hours}
### minutes
iex> TimeAgo.from_date ~N[2019-12-21 18:00:00], ~N[2019-12-21 18:30:00]
{30, :minutes}
### seconds
iex> TimeAgo.from_date ~N[2019-12-21 13:00:00], ~N[2019-12-21 13:00:55]
{55, :seconds}