MastoAPI: Fix date in account view.
This commit is contained in:
parent
eb248cf8aa
commit
d659fcc195
4 changed files with 23 additions and 7 deletions
|
|
@ -119,6 +119,23 @@ defmodule Pleroma.Web.CommonAPI.Utils do
|
|||
end
|
||||
end
|
||||
|
||||
def to_masto_date(%NaiveDateTime{} = date) do
|
||||
date
|
||||
|> NaiveDateTime.to_iso8601
|
||||
|> String.replace(~r/(\.\d+)?$/, ".000Z", global: false)
|
||||
end
|
||||
|
||||
def to_masto_date(date) do
|
||||
try do
|
||||
date
|
||||
|> NaiveDateTime.from_iso8601!
|
||||
|> NaiveDateTime.to_iso8601
|
||||
|> String.replace(~r/(\.\d+)?$/, ".000Z", global: false)
|
||||
rescue
|
||||
_e -> ""
|
||||
end
|
||||
end
|
||||
|
||||
defp shortname(name) do
|
||||
if String.length(name) < 30 do
|
||||
name
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue