Fix records on this day for partial release dates

SQLite interprets bare years (e.g. "1970") as Julian day numbers
in strftime, producing wrong month-day matches. Filter to only
full YYYY-MM-DD dates before comparing.
This commit is contained in:
Claudio Ortolina
2026-04-15 07:29:58 +01:00
parent ebd9e5445f
commit b9612a2a26
2 changed files with 77 additions and 1 deletions
+7 -1
View File
@@ -58,7 +58,13 @@ defmodule MusicLibrary.Collection do
q =
from r in Record,
where: not is_nil(r.purchased_at),
where: fragment("strftime('%m-%d', ?) = ?", r.release_date, ^month_day),
where:
fragment(
"length(?) = 10 AND strftime('%m-%d', ?) = ?",
r.release_date,
r.release_date,
^month_day
),
order_by: [{:desc, r.release_date}, order_alphabetically()],
select: ^Records.essential_fields()