Slightly improve timestamps for old posts
This commit is contained in:
parent
4733aa23ab
commit
0afe2d3b30
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in New Issue