Reputation: 8318
I have a user
model:
defmodule AddressBook.User do
use AddressBook.Web, :model
schema "users" do
field :last_name, :string
field :birthday, Ecto.Date
[...]
I want to use https://github.com/ikeikeikeike/phoenix_html_simplified_helpers to render time_ago_in_words
for the birthday
:
<%= time_ago_in_words user.birthday %> ago
But that results in this error:
How can I fix this?
Upvotes: 1
Views: 56
Reputation: 222188
It looks like that package does not support Ecto.Date
, only Ecto.DateTime
, Timex.DateTime
, or raw seconds offset. This should work:
<%= time_ago_in_words Ecto.DateTime.from_date(user.birthday) %> ago
Upvotes: 1