TemporalZ

toPlainDate

Returns a PlainDate representing this year-month and a supplied day in the same calendar system.

See: Temporal.PlainYearMonth.toPlainDate

Parameters

#
self:PlainYearMonth
PlainYearMonth
day:u8
u8

Source

Implementation

#
pub fn toPlainDate(self: PlainYearMonth, day: u8) !PlainDate {
    const partial_date = abi.c.PartialDate_option{
        .is_ok = true,
        .unnamed_0 = .{
            .ok = .{
                .year = .{ .is_ok = false },
                .month = .{ .is_ok = false },
                .day = abi.toOption(abi.c.OptionU8, day),
                .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_PlainYearMonth_to_plain_date(self._inner, partial_date);
    const ptr = (try abi.extractResult(result)) orelse return abi.TemporalError.Generic;

    return PlainDate{ ._inner = ptr };
}