lock down date used in render function when under test
This commit is contained in:
parent
f0b382375e
commit
f936422b07
1 changed files with 4 additions and 1 deletions
|
|
@ -100,7 +100,10 @@ pub fn render(writer: *std.Io.Writer, weather: types.WeatherData, format: []cons
|
||||||
}
|
}
|
||||||
|
|
||||||
fn nowAt(coords: Coordinates) !i64 {
|
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 offset = TimeZoneOffsets.getTimezoneOffset(coords);
|
||||||
const new = if (offset >= 0)
|
const new = if (offset >= 0)
|
||||||
try now.add(.{ .minutes = @abs(offset) })
|
try now.add(.{ .minutes = @abs(offset) })
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue