From 9fd8780bf8393e0a5a338afbc1da38c3f5ca578a Mon Sep 17 00:00:00 2001 From: "Nurul Huda (Apon)" Date: Mon, 26 Jan 2026 23:22:49 +0600 Subject: [PATCH] fix(zoned): fix timezoneid --- src/ZonedDateTime.zig | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/ZonedDateTime.zig b/src/ZonedDateTime.zig index 0865461..c67decf 100644 --- a/src/ZonedDateTime.zig +++ b/src/ZonedDateTime.zig @@ -423,8 +423,11 @@ pub fn second(self: ZonedDateTime) u8 { pub fn timeZoneId(self: ZonedDateTime, allocator: std.mem.Allocator) ![]u8 { const tz = abi.c.temporal_rs_ZonedDateTime_timezone(self._inner); - const view = abi.fromDiplomatStringView(tz.normalized_id); - return try allocator.dupe(u8, view); + var write = abi.DiplomatWrite.init(allocator); + + abi.c.temporal_rs_TimeZone_identifier(tz, &write.inner); + + return try write.toOwnedSlice(); } pub fn weekOfYear(self: ZonedDateTime) ?u8 { @@ -576,7 +579,7 @@ test "props" { try std.testing.expectEqual(@as(u8, 0), zdt.second()); try std.testing.expectEqual(@as(u16, 0), zdt.millisecond()); - // const tzo = try zdt.timeZoneId(std.testing.allocator); - // defer std.testing.allocator.free(tzo); - // try std.testing.expectEqualStrings("UTC", tzo); + const tzo = try zdt.timeZoneId(std.testing.allocator); + defer std.testing.allocator.free(tzo); + try std.testing.expectEqualStrings("UTC", tzo); }