lock down date used in render function when under test

This commit is contained in:
Emil Lerch 2026-01-09 11:58:54 -08:00
parent f0b382375e
commit f936422b07
Signed by: lobo
GPG key ID: A7B62D657EF764F8

View file

@ -100,7 +100,10 @@ pub fn render(writer: *std.Io.Writer, weather: types.WeatherData, format: []cons
}
fn nowAt(coords: Coordinates) !i64 {
const now = try zeit.instant(.{});
const now = if (@import("builtin").is_test)
(try zeit.Time.fromISO8601("2026-01-09")).instant()
else
try zeit.instant(.{});
const offset = TimeZoneOffsets.getTimezoneOffset(coords);
const new = if (offset >= 0)
try now.add(.{ .minutes = @abs(offset) })