TemporalZ

era

Returns the calendar-specific era of this date, or null if not applicable.

See: Temporal.ZonedDateTime.era

Parameters

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

Source

Implementation

#
pub fn era(self: ZonedDateTime, allocator: std.mem.Allocator) !?[]u8 {
    var write = abi.DiplomatWrite.init(allocator);
    defer write.deinit();
    abi.c.temporal_rs_ZonedDateTime_era(self._inner, &write.inner);
    const result = try write.toOwnedSlice();
    if (result.len == 0) {
        allocator.free(result);
        return null;
    }
    return result;
}