Tox (tox v0.2.3)

Some structs and functions to work with dates, times, durations, periods, and intervals.

Link to this section Summary

Types

Boundaries specifies whether the start and end of an interval are included or excluded.

An amount of time with a specified unit e.g. {second: 500}.

Units related to dates and times.

Functions

Shift the DateTime, NaiveDateTime, Date or Time by the given duration.

Link to this section Types

Link to this type

boundaries()

Specs

boundaries() :: :closed | :left_open | :right_open | :open

Boundaries specifies whether the start and end of an interval are included or excluded.

  • :open: start and end are excluded
  • :closed: start and end are included
  • :left_open: start is excluded and end is included
  • :right_open: start is included and end is excluded

Specs

duration() :: {unit(), integer()}

An amount of time with a specified unit e.g. {second: 500}.

Specs

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

Units related to dates and times.

Link to this section Functions

Link to this function

shift(datetime, duration)

Specs

shift(date_or_time, [duration()]) :: date_or_time
when date_or_time: DateTime.t() | NaiveDateTime.t() | Date.t() | Time.t()

Shift the DateTime, NaiveDateTime, Date or Time by the given duration.