Use user timezone in emails

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel
2020-11-16 18:28:52 +01:00
parent 06a1233fc2
commit fdc8536c6f
7 changed files with 80 additions and 20 deletions

View File

@@ -16,4 +16,15 @@ defmodule Mobilizon.Web.EmailView do
string
end
end
@spec datetime_tz_convert(DateTime.t(), String.t()) :: DateTime.t()
def datetime_tz_convert(%DateTime{} = datetime, timezone) do
case DateTime.shift_zone(datetime, timezone) do
{:ok, datetime_with_user_tz} ->
datetime_with_user_tz
_ ->
datetime
end
end
end