withCalendar
Returns a new ZonedDateTime interpreted in the new calendar system.
Parameters
- self:ZonedDateTime
- ZonedDateTime
- calendar:[]const u8
- []const u8
Source
Implementation
pub fn withCalendar(self: ZonedDateTime, calendar: []const u8) !ZonedDateTime {
const cal_view = abi.toDiplomatStringView(calendar);
const cal_result = abi.c.temporal_rs_AnyCalendarKind_parse_temporal_calendar_string(cal_view);
const cal_kind = try abi.extractResult(cal_result);
const ptr = abi.c.temporal_rs_ZonedDateTime_with_calendar(self._inner, cal_kind);
if (ptr == null) return error.TemporalError;
return .{ ._inner = ptr.? };
}