Render timestamps as dates
No need for time precision in the UI
This commit is contained in:
@@ -52,4 +52,8 @@ defmodule MusicLibraryWeb.RecordLive.Show do
|
|||||||
defp musicbrainz_url(record) do
|
defp musicbrainz_url(record) do
|
||||||
"https://musicbrainz.org/release-group/#{record.musicbrainz_id}"
|
"https://musicbrainz.org/release-group/#{record.musicbrainz_id}"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
defp human_datetime(dt) do
|
||||||
|
"#{dt.day}/#{dt.month}/#{dt.year}"
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -67,7 +67,7 @@
|
|||||||
<%= gettext("Purchased on") %>
|
<%= gettext("Purchased on") %>
|
||||||
</dt>
|
</dt>
|
||||||
<dd class="mt-1 text-sm leading-6 text-zinc-700 dark:text-zinc-300 sm:col-span-2 sm:mt-0">
|
<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>
|
</dd>
|
||||||
</div>
|
</div>
|
||||||
<div class="py-2 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-0">
|
<div class="py-2 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-0">
|
||||||
@@ -75,7 +75,7 @@
|
|||||||
<%= gettext("Inserted at") %>
|
<%= gettext("Inserted at") %>
|
||||||
</dt>
|
</dt>
|
||||||
<dd class="mt-1 text-sm leading-6 text-zinc-700 dark:text-zinc-300 sm:col-span-2 sm:mt-0">
|
<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>
|
</dd>
|
||||||
</div>
|
</div>
|
||||||
<div class="py-2 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-0">
|
<div class="py-2 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-0">
|
||||||
@@ -83,7 +83,7 @@
|
|||||||
<%= gettext("Updated at") %>
|
<%= gettext("Updated at") %>
|
||||||
</dt>
|
</dt>
|
||||||
<dd class="mt-1 text-sm leading-6 text-zinc-700 dark:text-zinc-300 sm:col-span-2 sm:mt-0">
|
<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>
|
</dd>
|
||||||
</div>
|
</div>
|
||||||
</dl>
|
</dl>
|
||||||
|
|||||||
@@ -52,4 +52,8 @@ defmodule MusicLibraryWeb.WishlistLive.Show do
|
|||||||
defp musicbrainz_url(record) do
|
defp musicbrainz_url(record) do
|
||||||
"https://musicbrainz.org/release-group/#{record.musicbrainz_id}"
|
"https://musicbrainz.org/release-group/#{record.musicbrainz_id}"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
defp human_datetime(dt) do
|
||||||
|
"#{dt.day}/#{dt.month}/#{dt.year}"
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -67,7 +67,7 @@
|
|||||||
<%= gettext("Inserted at") %>
|
<%= gettext("Inserted at") %>
|
||||||
</dt>
|
</dt>
|
||||||
<dd class="mt-1 text-sm leading-6 text-zinc-700 dark:text-zinc-300 sm:col-span-2 sm:mt-0">
|
<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>
|
</dd>
|
||||||
</div>
|
</div>
|
||||||
<div class="py-2 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-0">
|
<div class="py-2 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-0">
|
||||||
@@ -75,7 +75,7 @@
|
|||||||
<%= gettext("Updated at") %>
|
<%= gettext("Updated at") %>
|
||||||
</dt>
|
</dt>
|
||||||
<dd class="mt-1 text-sm leading-6 text-zinc-700 dark:text-zinc-300 sm:col-span-2 sm:mt-0">
|
<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>
|
</dd>
|
||||||
</div>
|
</div>
|
||||||
</dl>
|
</dl>
|
||||||
|
|||||||
@@ -11,6 +11,10 @@ defmodule MusicLibraryWeb.RecordShowTest do
|
|||||||
|> Phoenix.HTML.safe_to_string()
|
|> Phoenix.HTML.safe_to_string()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
defp human_datetime(dt) do
|
||||||
|
"#{dt.day}/#{dt.month}/#{dt.year}"
|
||||||
|
end
|
||||||
|
|
||||||
describe "Edit record from show page" do
|
describe "Edit record from show page" do
|
||||||
test "can navigate to the record edit form", %{conn: conn} do
|
test "can navigate to the record edit form", %{conn: conn} do
|
||||||
record = record_fixture()
|
record = record_fixture()
|
||||||
@@ -36,9 +40,9 @@ defmodule MusicLibraryWeb.RecordShowTest do
|
|||||||
assert html =~ Record.format_long_label(record.format)
|
assert html =~ Record.format_long_label(record.format)
|
||||||
assert html =~ record.release
|
assert html =~ record.release
|
||||||
assert html =~ ~p"/covers/#{record.id}?vsn=#{record.cover_hash}"
|
assert html =~ ~p"/covers/#{record.id}?vsn=#{record.cover_hash}"
|
||||||
assert html =~ Phoenix.HTML.Safe.to_iodata(record.purchased_at)
|
assert html =~ human_datetime(record.purchased_at)
|
||||||
assert html =~ Phoenix.HTML.Safe.to_iodata(record.inserted_at)
|
assert html =~ human_datetime(record.inserted_at)
|
||||||
assert html =~ Phoenix.HTML.Safe.to_iodata(record.updated_at)
|
assert html =~ human_datetime(record.updated_at)
|
||||||
|
|
||||||
for artist <- record.artists do
|
for artist <- record.artists do
|
||||||
assert html =~ escape(artist.name)
|
assert html =~ escape(artist.name)
|
||||||
|
|||||||
Reference in New Issue
Block a user