diff options
author | Ivan Tashkinov <ivant.business@gmail.com> | 2019-04-04 23:43:08 +0300 |
---|---|---|
committer | Ivan Tashkinov <ivant.business@gmail.com> | 2019-04-04 23:43:08 +0300 |
commit | 45765918c377c6daf8ee8e5bfad4ea24f67766b6 (patch) | |
tree | a8ccea9436d7c533a481939a4724c62d8ffac4c0 /lib/pleroma/web/common_api/utils.ex | |
parent | f7cd9131d4aa0da3c4c0174acc56ce1bbdbd284c (diff) | |
parent | 9c9eec62c2fb67507708dd9e5d3f80a098881a6e (diff) | |
download | pleroma-45765918c377c6daf8ee8e5bfad4ea24f67766b6.tar.gz |
[#923] Merge remote-tracking branch 'remotes/upstream/develop' into twitter_oauth
# Conflicts:
# mix.exs
Diffstat (limited to 'lib/pleroma/web/common_api/utils.ex')
-rw-r--r-- | lib/pleroma/web/common_api/utils.ex | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/lib/pleroma/web/common_api/utils.ex b/lib/pleroma/web/common_api/utils.ex index 40cea3090..9cd8b3758 100644 --- a/lib/pleroma/web/common_api/utils.ex +++ b/lib/pleroma/web/common_api/utils.ex @@ -15,6 +15,8 @@ defmodule Pleroma.Web.CommonAPI.Utils do alias Pleroma.Web.Endpoint alias Pleroma.Web.MediaProxy + require Logger + # This is a hack for twidere. def get_by_id_or_ap_id(id) do activity = @@ -240,15 +242,21 @@ defmodule Pleroma.Web.CommonAPI.Utils do Strftime.strftime!(date, "%a %b %d %H:%M:%S %z %Y") end - def date_to_asctime(date) do - with {:ok, date, _offset} <- date |> DateTime.from_iso8601() do + def date_to_asctime(date) when is_binary(date) do + with {:ok, date, _offset} <- DateTime.from_iso8601(date) do format_asctime(date) else _e -> + Logger.warn("Date #{date} in wrong format, must be ISO 8601") "" end end + def date_to_asctime(date) do + Logger.warn("Date #{date} in wrong format, must be ISO 8601") + "" + end + def to_masto_date(%NaiveDateTime{} = date) do date |> NaiveDateTime.to_iso8601() |