diff --git a/src/Instant.zig b/src/Instant.zig index a2b1b4c..612b2a2 100644 --- a/src/Instant.zig +++ b/src/Instant.zig @@ -510,7 +510,17 @@ test toJSON { } test toZonedDateTimeISO { - if (true) return error.SkipZigTest; + const inst = try Instant.fromEpochMilliseconds(1704067200000); + defer inst.deinit(); + + const zdt = try inst.toZonedDateTimeISO(try TimeZone.init("UTC")); + defer zdt.deinit(); + + try std.testing.expectEqual(@as(i32, 2024), zdt.year()); + try std.testing.expectEqual(@as(u8, 1), zdt.month()); + try std.testing.expectEqual(@as(u8, 1), zdt.day()); + try std.testing.expectEqual(@as(u8, 0), zdt.hour()); + try std.testing.expectEqual(@as(i128, 1_704_067_200_000_000_000), zdt.epochNanoseconds()); } test epochMilliseconds { diff --git a/src/ZonedDateTime.zig b/src/ZonedDateTime.zig index d4b6ae9..617a8a7 100644 --- a/src/ZonedDateTime.zig +++ b/src/ZonedDateTime.zig @@ -662,7 +662,11 @@ test add { } test getTimeZoneTransition { - if (true) return error.SkipZigTest; // getTimeZoneTransition() not properly implemented in underlying library + const zdt = try from("2021-01-01T12:00:00+00:00[UTC]", null, .compatible, .reject); + defer zdt.deinit(); + + try std.testing.expectEqual(@as(?ZonedDateTime, null), try zdt.getTimeZoneTransition(.next)); + try std.testing.expectEqual(@as(?ZonedDateTime, null), try zdt.getTimeZoneTransition(.previous)); } test round { @@ -914,7 +918,12 @@ test nanosecond { } test offset { - if (true) return error.SkipZigTest; // offset() throws RangeError with UTC timezone + const zdt = try from("2021-01-01T12:00:00+00:00[UTC]", null, .compatible, .reject); + defer zdt.deinit(); + + const off = try zdt.offset(std.testing.allocator); + defer std.testing.allocator.free(off); + try std.testing.expectEqualStrings("+00:00", off); } test offsetNanoseconds {