TemporalZ

toString

Returns a string representing this ZonedDateTime in RFC 9557 format, with options for formatting.

See: Temporal.ZonedDateTime.toString

Parameters

#
self:ZonedDateTime
ZonedDateTime
allocator:std.mem.Allocator
std.mem.Allocator
opts:ToStringOptions
ToStringOptions

Source

Implementation

#
pub fn toString(self: ZonedDateTime, allocator: std.mem.Allocator, opts: ToStringOptions) ![]u8 {
    var write = abi.DiplomatWrite.init(allocator);
    defer write.deinit();

    const result = abi.c.temporal_rs_ZonedDateTime_to_ixdtf_string(
        self._inner,
        abi.to.displayOffset(opts.offset_display),
        abi.to.toDisplayTimeZone(opts.time_zone_name),
        abi.to.calendarDisplay(opts.calendar_display),
        abi.to_string_rounding_options_auto,
        &write.inner,
    );

    if (!result.is_ok) return error.TemporalError;
    return try write.toOwnedSlice();
}