Show dates in european format
Some checks reported errors
continuous-integration/drone/push Build was killed

This commit is contained in:
Rafael Epplée 2025-12-02 16:59:46 +01:00
parent ee414c9440
commit e6c5a58c65
No known key found for this signature in database
GPG key ID: B4EFE6DC59FAE118
6 changed files with 54 additions and 11 deletions

View file

@ -6,6 +6,7 @@ defmodule MvWeb.MemberLive.Index.Formatter do
formats them appropriately for display in the UI.
"""
use Gettext, backend: MvWeb.Gettext
alias MvWeb.Helpers.DateFormatter
@doc """
Formats a custom field value for display.
@ -61,11 +62,11 @@ defmodule MvWeb.MemberLive.Index.Formatter do
defp format_value_by_type(value, :boolean, _) when value == false, do: gettext("No")
defp format_value_by_type(value, :boolean, _), do: to_string(value)
defp format_value_by_type(%Date{} = date, :date, _), do: Date.to_string(date)
defp format_value_by_type(%Date{} = date, :date, _), do: DateFormatter.format_date(date)
defp format_value_by_type(value, :date, _) when is_binary(value) do
case Date.from_iso8601(value) do
{:ok, date} -> Date.to_string(date)
{:ok, date} -> DateFormatter.format_date(date)
_ -> value
end
end