RelativeTime (relative_time v0.1.0)

Link to this section Summary

Types

A marker is a specific point in time that is accessible in a relative time term

Link to this section Types

Specs

edge() :: :past | :future
Link to this type

edge_option()

Specs

edge_option() :: {:edge, edge()}

Specs

input() :: String.t()

Specs

marker() :: {atom(), DateTime.t()}

A marker is a specific point in time that is accessible in a relative time term

The keyword now is also a marker, and it is possible to set a custom now marker to override it, for testing purposes for example.

Specs

markers() :: {:markers, [marker()]}

Specs

option() :: markers() | edge_option()

Specs

options() :: [option()]

Specs

unit() :: :second | :minute | :hour | :day | :week | :month | :year

Link to this section Functions

Link to this function

from(input, opts \\ [])

Specs

from(input(), options()) :: {:ok, DateTime.t()} | {:error, any()}
Link to this function

to(input, opts \\ [])

Specs

to(input(), options()) :: {:ok, DateTime.t()} | {:error, any()}