mirror of
https://github.com/philomena-dev/philomena.git
synced 2024-11-27 13:47:58 +01:00
fix apparent skew
This commit is contained in:
parent
f21eaa87bb
commit
a86be3b17c
1 changed files with 2 additions and 1 deletions
|
@ -18,6 +18,7 @@ defmodule PhilomenaWeb.AppView do
|
||||||
def pretty_time(time) do
|
def pretty_time(time) do
|
||||||
seconds = NaiveDateTime.diff(NaiveDateTime.utc_now(), time, :second)
|
seconds = NaiveDateTime.diff(NaiveDateTime.utc_now(), time, :second)
|
||||||
relation = if seconds < 0, do: "from now", else: "ago"
|
relation = if seconds < 0, do: "from now", else: "ago"
|
||||||
|
time = time |> DateTime.from_naive!("Etc/UTC")
|
||||||
|
|
||||||
seconds = abs(seconds)
|
seconds = abs(seconds)
|
||||||
minutes = abs(div(seconds, 60))
|
minutes = abs(div(seconds, 60))
|
||||||
|
@ -41,7 +42,7 @@ defmodule PhilomenaWeb.AppView do
|
||||||
true -> String.replace(@time_strings[:years], "%d", to_string(years))
|
true -> String.replace(@time_strings[:years], "%d", to_string(years))
|
||||||
end
|
end
|
||||||
|
|
||||||
content_tag(:time, "#{words} #{relation}", datetime: time |> NaiveDateTime.to_iso8601())
|
content_tag(:time, "#{words} #{relation}", datetime: time |> DateTime.to_iso8601())
|
||||||
end
|
end
|
||||||
|
|
||||||
def can?(conn, action, model) do
|
def can?(conn, action, model) do
|
||||||
|
|
Loading…
Reference in a new issue