╭ changed ──────────────╮ │src/ui/Repo/Commits.zig│ ╰───────────────────────╯ ╭───────────╮ │← all files│ ╰───────────╯ ╭────────────────────────────────────────────────────────╮ │3 const ui = @import("../../ui.zig"); │ │4 const xit = @import("xit"); │ │5 const rp = xit.repo; │ │6 -const Undo = @import("Undo.zig"); │ │6 const obj = xit.object; │ │7 const mrg = xit.merge; │ │8 const srch_cmmt = @import("../../search_commit.zig");│ ╰────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────╮ │26 oid: []const u8, │ │27 // what its diff is against: the first parent, all zeros for a root commit│ │28 parent_oid: []const u8, │ │30 - date: []const u8, // "YYYY-MM-DD" │ │29 message: []const u8, // trimmed, may be multi-line │ │30 // whether `message` is a shortened preview. │ │31 message_truncated: bool = false, │ ╰──────────────────────────────────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────╮ │32 author: ui.Author = .unknown, │ │33 // .unknown when the committer is the author.│ │34 committer: ui.Author = .unknown, │ │37 - // the committer timestamp, human-readable. │ │38 - timestamp: []const u8, │ │35 + // the committer timestamp, in unix seconds. │ │36 + timestamp: i64, │ │37 // whether it has a second parent. │ │38 merge: bool = false, │ │39 stats: ?xit.patch.CommitStats = null, │ ╰─────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │233 return .{ │ │234 .oid = try aa.dupe(u8, &commit_object.oid), │ │235 .parent_oid = if (md.firstParent()) |parent| try aa.dupe(u8, parent) else &@as([xit.hash.hexLen(repo_opts.hash)]u8, @splat('0')),│ │238 - .date = try formatDate(aa, md.timestamp), │ │236 .message = text, │ │237 .message_truncated = truncated, │ │238 .author = try ui.Author.init(admin_moment, arena, md.author orelse ""), │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │240 (if (std.mem.eql(u8, identityOf(committer), identityOf(md.author orelse ""))) .unknown else try ui.Author.init(admin_moment, arena, committer))│ │241 else │ │242 .unknown, │ │246 - .timestamp = try Undo.formatTimestamp(aa, std.math.cast(i64, md.timestamp) orelse -1), │ │243 + .timestamp = std.math.cast(i64, md.timestamp) orelse -1, │ │244 .merge = if (md.parent_oids) |parent_oids| parent_oids.len > 1 else false, │ │245 .stats = if (repo_kind == .xit) try repo.commitStats(io, gpa, .{ .oid = &commit_object.oid }) else null, │ │246 }; │ ╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭────────────────────────────────────────────────────────────────────────────────────╮ │291 .commits = &.{}, │ │292 .next_start = null, │ │293 }; │ │297 -} │ │298 - │ │299 -// "YYYY-MM-DD" for a unix timestamp. │ │300 -fn formatDate(arena: std.mem.Allocator, timestamp: u64) ![]const u8 { │ │301 - const epoch_secs = std.time.epoch.EpochSeconds{ .secs = timestamp }; │ │302 - const year_day = epoch_secs.getEpochDay().calculateYearDay(); │ │303 - const month_day = year_day.calculateMonthDay(); │ │304 - return arena.print("{d:0>4}-{d:0>2}-{d:0>2}", .{ │ │305 - year_day.year, │ │306 - month_day.month.numeric(), │ │307 - month_day.day_index + 1, │ │308 - }); │ │294 } │ │295 │ │296 // the commit message, trimmed and read into `aa`, plus whether its preview was│ ╰────────────────────────────────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │637 tb.options.top_label.text = " committer "; │ │638 try row.children.put(allocator, tb.getFocus().id, .{ .widget = .{ .text_box = tb }, .rect = null, .min_size = null }); │ │639 } │ │655 - var tb = try wgt.TextBox.init(allocator, commit.timestamp, .{ .border = .single, .round_corners = true, .wrap_kind = .none }); │ │640 + const timestamp = try ui.timestamp.format(pa.allocator(), commit.timestamp, try self.session.nowSeconds()); │ │641 + var tb = try wgt.TextBox.init(allocator, timestamp.relative, .{ .border = .single, .round_corners = true, .wrap_kind = .none, .bottom_label = .{ .text = timestamp.exact } });│ │642 errdefer tb.deinit(allocator); │ │643 tb.getFocus().mode = .all; │ │644 try row.children.put(allocator, tb.getFocus().id, .{ .widget = .{ .text_box = tb }, .rect = null, .min_size = null }); │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯