Formatting a birthday in years def age_post(post) do

    birthday = Timex.date({post.birthday_year, post.birthday_month, post.birthday_day})
    now = Date.now

    years = Timex.diff(now, birthday, :years)

    Integer.to_string(years) &lt;&gt; " ans"

  end


I'm quite new with the elixir language, I'm pretty sure you can get the same result than that code in one line.
You could cut out some of those intermediate variables using the pipeline operator: |&gt;

def age_post(post) do
  birthday = Timex.date({post.birthday_year, post.birthday_month, post.birthday_day})

  (Date.now |&gt; Timex.diff(birthday, :years) |&gt; Integer.to_string) &lt;&gt; " ans"
end