fix(zoned): fix timezoneid
This commit is contained in:
parent
7f5b8e4e5b
commit
9fd8780bf8
1 changed files with 8 additions and 5 deletions
|
|
@ -423,8 +423,11 @@ pub fn second(self: ZonedDateTime) u8 {
|
||||||
|
|
||||||
pub fn timeZoneId(self: ZonedDateTime, allocator: std.mem.Allocator) ![]u8 {
|
pub fn timeZoneId(self: ZonedDateTime, allocator: std.mem.Allocator) ![]u8 {
|
||||||
const tz = abi.c.temporal_rs_ZonedDateTime_timezone(self._inner);
|
const tz = abi.c.temporal_rs_ZonedDateTime_timezone(self._inner);
|
||||||
const view = abi.fromDiplomatStringView(tz.normalized_id);
|
var write = abi.DiplomatWrite.init(allocator);
|
||||||
return try allocator.dupe(u8, view);
|
|
||||||
|
abi.c.temporal_rs_TimeZone_identifier(tz, &write.inner);
|
||||||
|
|
||||||
|
return try write.toOwnedSlice();
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn weekOfYear(self: ZonedDateTime) ?u8 {
|
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(u8, 0), zdt.second());
|
||||||
try std.testing.expectEqual(@as(u16, 0), zdt.millisecond());
|
try std.testing.expectEqual(@as(u16, 0), zdt.millisecond());
|
||||||
|
|
||||||
// const tzo = try zdt.timeZoneId(std.testing.allocator);
|
const tzo = try zdt.timeZoneId(std.testing.allocator);
|
||||||
// defer std.testing.allocator.free(tzo);
|
defer std.testing.allocator.free(tzo);
|
||||||
// try std.testing.expectEqualStrings("UTC", tzo);
|
try std.testing.expectEqualStrings("UTC", tzo);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue