toPlainDate
Returns a PlainDate representing this month-day and a supplied year in the same calendar system.
Parameters
- self:PlainMonthDay
- PlainMonthDay
- year:i32
- i32
Source
Implementation
pub fn toPlainDate(self: PlainMonthDay, year: i32) !PlainDate {
const partial_date = abi.c.PartialDate_option{
.is_ok = true,
.unnamed_0 = .{
.ok = .{
.year = abi.toOption(abi.c.OptionI32, year),
.month = .{ .is_ok = false },
.day = .{ .is_ok = false },
.month_code = .{ .data = null, .len = 0 },
.era = .{ .data = null, .len = 0 },
.era_year = .{ .is_ok = false },
.calendar = abi.c.AnyCalendarKind_Iso,
},
},
};
const result = abi.c.temporal_rs_PlainMonthDay_to_plain_date(self._inner, partial_date);
const ptr = (try abi.extractResult(result)) orelse return abi.TemporalError.Generic;
return PlainDate{ ._inner = ptr };
}