Fix error which crept in due to daylight savings and me being dumb

(clever).
This commit is contained in:
Nathan Fisher 2023-06-13 11:35:57 -04:00
parent d9214443a8
commit 66b9e61ed4

View File

@ -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).?,