diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/PlainMonthDay.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/PlainMonthDay.cpp index ead6405019..b88012f5e1 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/PlainMonthDay.cpp +++ b/Userland/Libraries/LibJS/Runtime/Temporal/PlainMonthDay.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2022, Linus Groh + * Copyright (c) 2021-2023, Linus Groh * Copyright (c) 2021, Luke Wilde * * SPDX-License-Identifier: BSD-2-Clause @@ -174,7 +174,7 @@ ThrowCompletionOr create_temporal_month_day(VM& vm, u8 iso_month } // 10.5.3 TemporalMonthDayToString ( monthDay, showCalendar ), https://tc39.es/proposal-temporal/#sec-temporal-temporalmonthdaytostring -ThrowCompletionOr temporal_month_day_to_string(VM& vm, PlainMonthDay& month_day, StringView show_calendar) +ThrowCompletionOr temporal_month_day_to_string(VM& vm, PlainMonthDay& month_day, StringView show_calendar) { // 1. Assert: Type(monthDay) is Object. // 2. Assert: monthDay has an [[InitializedTemporalMonthDay]] internal slot. @@ -182,16 +182,16 @@ ThrowCompletionOr temporal_month_day_to_string(VM& vm, PlainMo // 3. Let month be ToZeroPaddedDecimalString(temporalDate.[[ISOMonth]], 2). // 4. Let day be ToZeroPaddedDecimalString(temporalDate.[[ISODay]], 2). // 5. Let result be the string-concatenation of month, the code unit 0x002D (HYPHEN-MINUS), and day. - auto result = DeprecatedString::formatted("{:02}-{:02}", month_day.iso_month(), month_day.iso_day()); + auto result = TRY_OR_THROW_OOM(vm, String::formatted("{:02}-{:02}", month_day.iso_month(), month_day.iso_day())); // 6. Let calendarID be ? ToString(monthDay.[[Calendar]]). - auto calendar_id = TRY(Value(&month_day.calendar()).to_deprecated_string(vm)); + auto calendar_id = TRY(Value(&month_day.calendar()).to_string(vm)); // 7. If showCalendar is one of "always" or "critical", or if calendarID is not "iso8601", then if (show_calendar.is_one_of("always"sv, "critical"sv) || calendar_id != "iso8601"sv) { // a. Let year be ! PadISOYear(monthDay.[[ISOYear]]). // b. Set result to the string-concatenation of year, the code unit 0x002D (HYPHEN-MINUS), and result. - result = DeprecatedString::formatted("{}-{}", pad_iso_year(month_day.iso_year()), result); + result = TRY_OR_THROW_OOM(vm, String::formatted("{}-{}", pad_iso_year(month_day.iso_year()), result)); } // 8. Let calendarString be ! FormatCalendarAnnotation(calendarID, showCalendar). @@ -199,7 +199,7 @@ ThrowCompletionOr temporal_month_day_to_string(VM& vm, PlainMo // 9. Set result to the string-concatenation of result and calendarString. // 10. Return result. - return DeprecatedString::formatted("{}{}", result, calendar_string); + return TRY_OR_THROW_OOM(vm, String::formatted("{}{}", result, calendar_string)); } } diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/PlainMonthDay.h b/Userland/Libraries/LibJS/Runtime/Temporal/PlainMonthDay.h index 3d38f13298..5a8628a1da 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/PlainMonthDay.h +++ b/Userland/Libraries/LibJS/Runtime/Temporal/PlainMonthDay.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2022, Linus Groh + * Copyright (c) 2021-2023, Linus Groh * * SPDX-License-Identifier: BSD-2-Clause */ @@ -42,6 +42,6 @@ struct ISOMonthDay { ThrowCompletionOr to_temporal_month_day(VM&, Value item, Object const* options = nullptr); ThrowCompletionOr create_temporal_month_day(VM&, u8 iso_month, u8 iso_day, Object& calendar, i32 reference_iso_year, FunctionObject const* new_target = nullptr); -ThrowCompletionOr temporal_month_day_to_string(VM&, PlainMonthDay&, StringView show_calendar); +ThrowCompletionOr temporal_month_day_to_string(VM&, PlainMonthDay&, StringView show_calendar); }