1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2026-05-16 09:48:37 +02:00
Files
stk 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
..
2025-05-06 09:43:26 +02:00
2025-12-23 16:49:16 +01:00
2023-09-20 08:35:41 +03:00
2025-12-23 16:49:16 +01:00
2022-08-07 11:16:14 +10:00
2025-11-15 10:46:23 +01:00
2022-03-17 19:13:40 +11:00
2025-11-15 10:46:23 +01:00
2022-10-02 20:57:44 -07:00