toZonedDateTime
Returns a ZonedDateTime by combining this date with a time and time zone.
Parameters
- self:PlainDate
- PlainDate
- options:ToZonedDateTimeOptions
- ToZonedDateTimeOptions
Source
Implementation
pub fn toZonedDateTime(self: PlainDate, options: ToZonedDateTimeOptions) !ZonedDateTime {
const tz_view = abi.toDiplomatStringView(options.time_zone);
const tz_result = abi.c.temporal_rs_TimeZone_try_from_str(tz_view);
const time_zone = try abi.extractResult(tz_result);
const time_ptr = if (options.plain_time) |tt| tt._inner else null;
const ptr = (try abi.extractResult(abi.c.temporal_rs_PlainDate_to_zoned_date_time(self._inner, time_zone, time_ptr))) orelse return abi.TemporalError.Generic;
return .{ ._inner = ptr };
}