with
Returns a new ZonedDateTime with some fields replaced by new values. See MDN Temporal.ZonedDateTime.prototype.with()
Parameters
- self:ZonedDateTime
- ZonedDateTime
- allocator:std.mem.Allocator
- std.mem.Allocator
- fields:anytype
- anytype
Source
Implementation
pub fn with(self: ZonedDateTime, allocator: std.mem.Allocator, fields: anytype) !ZonedDateTime {
_ = allocator;
const partial = abi.toPartialZonedDateTime(fields);
const disambiguation = abi.toOption(abi.c.Disambiguation_option, abi.to.toDisambiguation(Disambiguation.compatible));
const offset_option = abi.toOption(abi.c.OffsetDisambiguation_option, abi.to.toOffsetDisambiguation(OffsetDisambiguation.prefer_offset));
const overflow = abi.c.ArithmeticOverflow_option{
.is_ok = true,
.unnamed_0 = .{ .ok = abi.c.ArithmeticOverflow_Constrain },
};
return wrapZonedDateTime(abi.c.temporal_rs_ZonedDateTime_with(
self._inner,
partial,
disambiguation,
offset_option,
overflow,
));
}