TemporalZ

era

Returns the era for this date, if any.

Parameters

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

Source

Implementation

#
pub fn era(self: PlainDate, allocator: std.mem.Allocator) !?[]u8 {
    var write = abi.DiplomatWrite.init(allocator);
    defer write.deinit();

    abi.c.temporal_rs_PlainDate_era(self._inner, &write.inner);
    const result = try write.toOwnedSlice();
    if (result.len == 0) {
        allocator.free(result);
        return null;
    }
    return result;
}