# NearestDate
NearestDate is a micro library to help finding the date with the smallest delta to a given date.
```
iex(1)> dates = [
...(1)> "1954-12-03 05:57:03.555380Z",
...(1)> "1966-08-12 18:31:33.555380Z",
...(1)> "2090-04-12 02:08:51.555380Z",
...(1)> "2116-09-02 04:21:16.555380Z",
...(1)> "2115-11-08 11:48:11.555380Z"
...(1)> ]
iex(2)> NearestDate.find!(dates, "2021-04-16 16:02:51.555380Z")
"2090-04-12 02:08:51.555380Z"
```
## Installation
If [available in Hex](https://hex.pm/docs/publish), the package can be installed
by adding `nearest_date` to your list of dependencies in `mix.exs`:
```elixir
def deps do
[
{:nearest_date, "~> 0.2.0"}
]
end
```
Documentation can be generated with [ExDoc](https://github.com/elixir-lang/ex_doc)
and published on [HexDocs](https://hexdocs.pm). Once published, the docs can
be found at [https://hexdocs.pm/nearest_date](https://hexdocs.pm/nearest_date).