Make sure we have a valid timezone

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel 2021-05-17 18:18:40 +02:00
parent b28402f7a7
commit bab751591f
No known key found for this signature in database
GPG Key ID: A061B9DDE0CA0773

View File

@ -291,6 +291,8 @@ defmodule Mobilizon.Service.Notifications.Scheduler do
end
defp date_to_datetime(%Date{} = day, time, timezone) do
# Just in case
timezone = timezone || "Etc/UTC"
{:ok, datetime} = NaiveDateTime.new(day, time)
{:ok, datetime} = DateTime.from_naive(datetime, timezone)
datetime