era
Returns the calendar-specific era of this date, or null if not applicable.
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;
}