Skip to content

Commit

Permalink
Add documentation concerning interval test (#408)
Browse files Browse the repository at this point in the history
  • Loading branch information
edouardmenayde authored and bitwalker committed Jan 30, 2018
1 parent 0a736dc commit 9f05a0f
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions docs/Basic Usage.md
Expand Up @@ -65,3 +65,18 @@ iex> Timex.format!(Timex.to_datetime(~N[2015-06-24T00:04:09.293], "America/Chica
iex> Timex.format!(Timex.to_datetime(~N[2015-06-24T00:04:09.293], "America/Chicago"), "{ISO:Extended:Z}")
"2015-06-24T05:04:13.293Z"
```

## Testing if one event occurs in an interval

```elixir
iex> use Timex
...> event = Timex.to_datetime({{2016, 6, 24}, {0, 0, 0}})
...> other_event = Timex.to_datetime({{2010, 1, 1}, {0, 0, 0}})
...> from = Timex.to_datetime({{2015, 1, 1}, {0, 0, 0}})
...> until = Timex.to_datetime({{2018, 1, 1}, {0, 0, 0}})
...> interval = Timex.Interval.new(from: from, until: until)
...> event in interval
true
...> other_event in interval
false
```

0 comments on commit 9f05a0f

Please sign in to comment.