Display releases in localized date format

This commit is contained in:
Claudio Ortolina
2024-10-14 16:36:41 +01:00
parent 6f7f0fed79
commit 9d76f3dfb7
3 changed files with 17 additions and 2 deletions
+11
View File
@@ -104,4 +104,15 @@ defmodule MusicLibrary.Records.Record do
def format_long_label(:blu_ray), do: "Blu-ray"
def format_long_label(:dvd), do: "DVD"
def format_long_label(:multi), do: "Multi"
def format_release(nil), do: "N/A"
def format_release(release) do
case String.split(release, "-") do
[] -> "N/A"
[year] -> year
[year, month] -> "#{month}/#{year}"
[year, month, day] -> "#{day}/#{month}/#{year}"
end
end
end