RelativeTime.Calculations (relative_time v0.1.0)

Link to this section Summary

Functions

From a keyword list of Timex.set/2 options, returns the unit that has the most precision. For example, if opts was [year: 2020, month: 2], month is the most precise unit.

Truncates the microsecond component of a datetime, depending on precision and existence already set in that datetime.

Link to this section Functions

Link to this function

most_precise_unit(opts)

From a keyword list of Timex.set/2 options, returns the unit that has the most precision. For example, if opts was [year: 2020, month: 2], month is the most precise unit.

Examples

iex> RelativeTime.Calculations.most_precise_unit([year: 2020])
:year
iex> RelativeTime.Calculations.most_precise_unit([hour: 12, minute: 30])
:minute
Link to this function

shift(datetime, interval, factor)

Specs

shift(DateTime.t(), tuple(), float()) :: DateTime.t() | {:error, any()}
Link to this function

trunc(datetime, edge, unit)

Specs

Link to this function

trunc_micro(dt, arg2)

Truncates the microsecond component of a datetime, depending on precision and existence already set in that datetime.