bitwalker / timex_ecto

An adapter for using Timex DateTimes with Ecto
MIT License
162 stars 68 forks source link

Timex.Ecto.Date.load appears to be using erl not Ecto.Date #59

Closed taylonr closed 7 years ago

taylonr commented 7 years ago

In iex, if I get a new Ecto.Date by calling:

ecto_date = Ecto.Date.utc()

It returns #Ecto.Date<2017-02-12>

If I then pass ecto_date into Timex.Ecto.Date.load I receive an :error

Looking at the code for Timex.Ecto.Date.load it's pattern matching on {_year, _month, _date}, which is not the standard Ecto date format, but is instead the erl format.

Either the function should be updated so that it's parameter is %Ecto.Date{} = date or the documentation should be changed to reflect that it takes an erl date.

~I'd be happy to create a PR for either direction.~

Created a PR (https://github.com/bitwalker/timex_ecto/pull/60) that adds support for Ecto.Date and spruces up the documentation.

bitwalker commented 7 years ago

Thanks again for the PR!