Render timestamps as dates

No need for time precision in the UI
This commit is contained in:
Claudio Ortolina
2024-10-29 16:18:22 +00:00
parent ba84b8fecf
commit 804727082c
5 changed files with 20 additions and 8 deletions
@@ -52,4 +52,8 @@ defmodule MusicLibraryWeb.RecordLive.Show do
defp musicbrainz_url(record) do
"https://musicbrainz.org/release-group/#{record.musicbrainz_id}"
end
defp human_datetime(dt) do
"#{dt.day}/#{dt.month}/#{dt.year}"
end
end
@@ -67,7 +67,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">
<%= @record.purchased_at %>
<%= human_datetime(@record.purchased_at) %>
</dd>
</div>
<div class="py-2 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-0">
@@ -75,7 +75,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">
<%= @record.inserted_at %>
<%= human_datetime(@record.inserted_at) %>
</dd>
</div>
<div class="py-2 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-0">
@@ -83,7 +83,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">
<%= @record.updated_at %>
<%= human_datetime(@record.updated_at) %>
</dd>
</div>
</dl>
@@ -52,4 +52,8 @@ defmodule MusicLibraryWeb.WishlistLive.Show do
defp musicbrainz_url(record) do
"https://musicbrainz.org/release-group/#{record.musicbrainz_id}"
end
defp human_datetime(dt) do
"#{dt.day}/#{dt.month}/#{dt.year}"
end
end
@@ -67,7 +67,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">
<%= @record.inserted_at %>
<%= human_datetime(@record.inserted_at) %>
</dd>
</div>
<div class="py-2 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-0">
@@ -75,7 +75,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">
<%= @record.updated_at %>
<%= human_datetime(@record.updated_at) %>
</dd>
</div>
</dl>