diff --git a/src/main.zig b/src/main.zig index 3131e3d..f43818e 100644 --- a/src/main.zig +++ b/src/main.zig @@ -284,7 +284,7 @@ pub const DateTime = struct { // days plus some remainder. So we take self.days - 1 for our calculation seconds += @as(i64, self.day - 1) * SECONDS_PER_DAY; if (self.hour) |h| { - seconds += @as(i64, h - 1) * 3600; + seconds += @as(i64, h) * 3600; } if (self.minute) |m| { seconds += @as(i64, m) * 60; @@ -334,7 +334,7 @@ test "to timestamp utc" { .year = Year.new(2023), .month = .june, .day = 13, - .hour = 6, + .hour = 5, .minute = 21, .second = 22, .tz = .utc, @@ -347,7 +347,7 @@ test "to timestamp negative offset" { .year = Year.new(2023), .month = .june, .day = 13, - .hour = 1, + .hour = 0, .minute = 21, .second = 22, .tz = TimeZone.new(-5, null).?,