View Source Ecto.DateTimeRange (Ecto DateTimeRange v0.2.0)
Ecto.DateTimeRange provides modules implementing Ecto.Type to allow
usage of Postgres range times encoding timestamp ranges.
Link to this section Summary
Functions
Create an Ecto.UTCDateTimeRange from two ISO8601 strings.
Link to this section Functions
Create an Ecto.UTCDateTimeRange from two ISO8601 strings.
example
Example
iex> import Ecto.DateTimeRange, only: [sigil_t: 2]
...>
iex> ~t(2020-02-02T00:01:00Z..2020-02-02T00:01:01Z)
%Ecto.UTCDateTimeRange{start_at: ~U[2020-02-02T00:01:00Z], end_at: ~U[2020-02-02T00:01:01Z]}
...>
iex> ~t(hi there)
** (ArgumentError) Unable to parse DateTime(s) from input
...>
iex> ~t(00:01:00Z..00:01:01Z)T
%Ecto.UTCTimeRange{start_at: ~T[00:01:00Z], end_at: ~T[00:01:01Z]}