debianize-mobilizon/lib/web/views/email_view.ex

20 lines
563 B
Elixir
Raw Normal View History

2020-01-26 21:36:50 +01:00
defmodule Mobilizon.Web.EmailView do
use Mobilizon.Web, :view
2020-01-26 21:36:50 +01:00
import Mobilizon.Web.Gettext
def datetime_to_string(%DateTime{} = datetime, locale \\ "en", format \\ :medium) do
with {:ok, string} <-
Mobilizon.Cldr.DateTime.to_string(datetime, format: format, locale: locale) do
string
end
end
def datetime_to_time_string(%DateTime{} = datetime, locale \\ "en", format \\ :hm) do
with {:ok, string} <-
Mobilizon.Cldr.DateTime.to_string(datetime, format: format, locale: locale) do
string
end
end
end