Consolidate datetime as date formatting

This commit is contained in:
Claudio Ortolina
2025-01-05 15:48:56 +00:00
parent 75154df3cf
commit 9428828064
8 changed files with 20 additions and 30 deletions
@@ -138,10 +138,6 @@ defmodule MusicLibraryWeb.CollectionLive.Show do
defp title_segment(:show), do: gettext("Show")
defp title_segment(:edit), do: gettext("Edit")
defp human_datetime(dt) do
"#{dt.day}/#{dt.month}/#{dt.year}"
end
defp toggle_actions_menu(record_id) do
JS.toggle(to: "#actions-#{record_id}")
|> JS.toggle_class("pointer-events-none", to: "#records > li")
@@ -181,7 +181,7 @@
{gettext("Purchased on")}
</dt>
<dd class="mt-1 text-sm leading-6 text-zinc-700 dark:text-zinc-300 sm:col-span-2 sm:mt-0">
{human_datetime(@record.purchased_at)}
{Records.Record.format_as_date(@record.purchased_at)}
</dd>
</div>
<div
@@ -204,7 +204,7 @@
{gettext("Inserted at")}
</dt>
<dd class="mt-1 text-sm leading-6 text-zinc-700 dark:text-zinc-300 sm:col-span-2 sm:mt-0">
{human_datetime(@record.inserted_at)}
{Records.Record.format_as_date(@record.inserted_at)}
</dd>
</div>
<div class="py-2 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-0">
@@ -212,7 +212,7 @@
{gettext("Updated at")}
</dt>
<dd class="mt-1 text-sm leading-6 text-zinc-700 dark:text-zinc-300 sm:col-span-2 sm:mt-0">
{human_datetime(@record.updated_at)}
{Records.Record.format_as_date(@record.updated_at)}
</dd>
</div>
</dl>
@@ -135,10 +135,6 @@ defmodule MusicLibraryWeb.WishlistLive.Show do
defp title_segment(:show), do: gettext("Show")
defp title_segment(:edit), do: gettext("Edit")
defp human_datetime(dt) do
"#{dt.day}/#{dt.month}/#{dt.year}"
end
defp toggle_actions_menu(record_id) do
JS.toggle(to: "#actions-#{record_id}")
|> JS.toggle_class("pointer-events-none", to: "#records > li")
@@ -214,7 +214,7 @@
{gettext("Inserted at")}
</dt>
<dd class="mt-1 text-sm leading-6 text-zinc-700 dark:text-zinc-300 sm:col-span-2 sm:mt-0">
{human_datetime(@record.inserted_at)}
{Records.Record.format_as_date(@record.inserted_at)}
</dd>
</div>
<div class="py-2 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-0">
@@ -222,7 +222,7 @@
{gettext("Updated at")}
</dt>
<dd class="mt-1 text-sm leading-6 text-zinc-700 dark:text-zinc-300 sm:col-span-2 sm:mt-0">
{human_datetime(@record.updated_at)}
{Records.Record.format_as_date(@record.updated_at)}
</dd>
</div>
</dl>