Commit Graph
7 Commits
Author SHA1 Message Date
stkandStefan Haller 5761f92e16 Make UnixToDateSmart timezone-deterministic
The "custom time format" test case of TestGetCommitListDisplayStrings failed on
Windows. Root cause: UnixToDateSmart used time.Unix(timestamp, 0), which formats
in process-local time. In tests we pass an explicit 'now' (often UTC), but the
timestamp was rendered in Local, causing one-hour drift on non-UTC machines.

The test tried to work around this by doing os.Setenv("TZ", "UTC"); however,
this only worked on Mac and Linux. On Windows, it has no effect because Windows
uses registry-based timezone configuration, not TZ environment variables.

Change: convert the timestamp into now.Location() before both the same-day
comparison and formatting.

Why this is safe: callers already define the presentation timezone via the 'now'
argument (typically time.Now() in app code, controlled time in tests). This
aligns timestamp rendering with that caller intent and removes dependence on
global TZ state or OS-specific environment variable behavior.

Added regression tests for UTC and UTC+1 to ensure deterministic behavior across
all platforms.
2026-05-02 17:59:27 +02:00
Jesse Duffield 9b24995990 Use 'M' for months in branches panel 2023-07-30 18:35:22 +10:00
Jesse Duffield 61f00e6dd4 update seconds ago function and add tests 2023-06-01 18:48:06 +10:00
Jesse Duffield 0e0458f355 More compact and flexible date format
You can now configure both a time format and a short time format, where the short format kicks in
when the time is within the last day
2023-05-26 17:31:39 +10:00
Ryooooooga 1f1d871837 feat: add ability to customize time format 2022-05-18 20:55:27 +09:00
Jesse Duffield 198d237679 more centralised handling of refreshing 2020-03-28 11:59:45 +11:00
Jesse Duffield fbbd16bd82 use reflogs from state to work out branch recencies 2020-03-28 11:59:45 +11:00