Fix date formatting in scrobble view

This commit is contained in:
mitteneer 2025-05-20 16:29:53 -04:00
parent d6a638bf27
commit 1734e6a4bb
2 changed files with 4 additions and 4 deletions

View file

@ -3,6 +3,7 @@ const jetzig = @import("jetzig");
const zeit = @import("zeit");
const TableRow = @import("../../types.zig").TableRow;
const HyperlinkData = @import("../../types.zig").HyperlinkData;
const Utils = @import("../../date_fmt.zig");
pub fn index(request: *jetzig.Request) !jetzig.View {
var root = try request.data(.object);
@ -35,8 +36,7 @@ pub fn index(request: *jetzig.Request) !jetzig.View {
try artistlist.append(.{ .name = scrobble.artist_name, .id = scrobble.artist_id });
continue :blk;
} else {
var date = std.ArrayList(u8).init(request.allocator);
try (try zeit.instant(.{ .source = .{ .unix_timestamp = @divFloor(scrobble.date, 1_000) } })).time().strftime(date.writer(), "%d %b %Y, %H:%M");
const date = try Utils.dateFmt(request.allocator, scrobble.date);
try artistlist.append(.{ .name = scrobble.artist_name, .id = scrobble.artist_id });
@ -44,7 +44,7 @@ pub fn index(request: *jetzig.Request) !jetzig.View {
.song = .{ .name = scrobble.song_name, .id = scrobble.song_id },
.album = .{ .name = scrobble.album_name, .id = scrobble.album_id },
.artistlist = try artistlist.toOwnedSlice(),
.date = date.items,
.date = date,
};
try scrobbles_view.append(row);