diff --git a/lib/clacks_web/views/frontend_view.ex b/lib/clacks_web/views/frontend_view.ex index 9c39124..a11439a 100644 --- a/lib/clacks_web/views/frontend_view.ex +++ b/lib/clacks_web/views/frontend_view.ex @@ -46,8 +46,17 @@ defmodule ClacksWeb.FrontendView do # less than a week, days "#{Integer.floor_div(diff, 60 * 60 * 24)}d" + diff < 60 * 60 * 24 * 30 -> + # less than a month(ish), weeks + "#{Integer.floor_div(diff, 60 * 60 * 24 * 7)}wk" + + diff < 60 * 60 * 24 * 365 -> + # less than a year, months(ish) + # todo: figure out actually how many months + "#{Integer.floor_div(diff, 60 * 60 * 24 * 30)}mo" + true -> - Timex.format!(datetime, "%FT%T%:z", :strftime) + Timex.format!(datetime, "%F", :strftime) end end