Use strftime to format date and datetimes

This commit is contained in:
Claudio Ortolina
2025-05-04 17:23:33 +01:00
parent 67714a1191
commit 0952bcd399
2 changed files with 3 additions and 3 deletions
+2 -2
View File
@@ -227,7 +227,7 @@ defmodule MusicLibrary.Records.Record do
end
end
def format_as_date(purchased_at) do
"#{purchased_at.day}/#{purchased_at.month}/#{purchased_at.year}"
def format_as_date(dt) do
Calendar.strftime(dt, "%d/%m/%Y")
end
end
+1 -1
View File
@@ -81,7 +81,7 @@ defmodule MusicLibrary.ScrobbleActivity do
|> DateTime.from_unix!()
|> DateTime.shift_zone!(timezone)
"#{ldt.day}/#{ldt.month}/#{ldt.year} #{ldt.hour}:#{ldt.minute}"
Calendar.strftime(ldt, "%d/%m/%Y %X")
end
defp recent_release_ids(recent_tracks) do