TemporalZ

init

Creates a new PlainMonthDay from the given month, day, and optional calendar. Equivalent to the Temporal.PlainMonthDay constructor.

See: Temporal.PlainMonthDay

Parameters

#
month_val:u8
u8
day_val:u8
u8
calendar:?[]const u8
?[]const u8

Source

Implementation

#
pub fn init(month_val: u8, day_val: u8, calendar: ?[]const u8) !PlainMonthDay {
    const cal_kind = if (calendar) |cal| blk: {
        const cal_view = abi.toDiplomatStringView(cal);
        const cal_result = abi.c.temporal_rs_AnyCalendarKind_parse_temporal_calendar_string(cal_view);
        break :blk try abi.extractResult(cal_result);
    } else abi.c.AnyCalendarKind_Iso;

    const overflow = abi.c.ArithmeticOverflow_Constrain;
    const ref_year = abi.c.OptionI32{ .is_ok = false };

    return wrapPlainMonthDay(abi.c.temporal_rs_PlainMonthDay_try_new_with_overflow(
        month_val,
        day_val,
        cal_kind,
        overflow,
        ref_year,
    ));
}