ago_times v0.1.1 EctoRange

A helper library to easily create relative times, like 2 days ago, to be used with Ecto.

The result of functions is always a %Ecto.DateTime{}.

Summary

Functions

Create a past time, yielding a %Ecto.DateTime{}

Functions

ago(number, unit)
ago(number :: integer, unit :: DateRange.time_unit) :: %Ecto.DateTime{day: term, hour: term, min: term, month: term, sec: term, usec: term, year: term}

Create a past time, yielding a %Ecto.DateTime{}.

Example:

# Create a DateTime, indicating 2 days ago
EctoRange.ago 2, :days

Available units are :seconds, :minutes, :hours, :days and :weeks.