Skip to content

History pane: the commit date format is fixed, and relative dates are a separate column #680

Open

Description

@goneng

The commit date in the history pane cannot be changed. There is no preference for it anywhere, and the format is frozen in the nib:

<dateFormatter key="formatter" dateStyle="long" timeStyle="short" id="414"/>

So you get "19 September 2026 at 14:05" and nothing else. No short form, no yyyy-MM-dd, no ISO, no way to drop the time on a pane where every row carries one.

Relative dates already exist, as the wrong shape

There is a RelativeDateColumn, driven by GitXRelativeDateFormatter. So relative time is available, but as a column you show or hide rather than a format the date column can take. Wanting "2 hours ago" instead of the absolute date means turning on a second column and turning the first one off, and the two then sort as separate things.

GitXRelativeDateFormatter is also hand-rolled, with the wording baked in:

if (secondsAgo < MINUTE) return @"seconds ago";
if (secondsAgo < (2 * MINUTE)) return @"1 minute ago";
if (secondsAgo < HOUR) return [NSString stringWithFormat:@"%ld minutes ago", (secondsAgo / MINUTE)];

None of that localizes, and it predates NSRelativeDateTimeFormatter, which has been available since macOS 10.15 and does this in the user's own language.

Suggested slices

  • a preference for the absolute format: the system short, medium and long styles, plus a custom pattern for people who want yyyy-MM-dd HH:mm
  • let the date column render relative time as one of those choices, so it is a format rather than a second column, keeping RelativeDateColumn working for anyone who has it turned on
  • move the relative wording onto NSRelativeDateTimeFormatter so it localizes, keeping the current phrasing as the default if it reads better
  • apply whatever is chosen wherever else a commit date is shown, rather than only in this one column

The first slice is useful on its own and does not depend on the rest.

Unrelated but the same pattern, for whoever picks this up: Preferences.xib carries its own hardcoded dateStyle="long" timeStyle="medium" formatter.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions