diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/Instant.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/Instant.cpp index 9eef0ae6ec..2533434491 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/Instant.cpp +++ b/Userland/Libraries/LibJS/Runtime/Temporal/Instant.cpp @@ -275,7 +275,7 @@ ThrowCompletionOr temporal_instant_to_string(VM& vm, Instant& instant, V auto offset_ns = TRY(get_offset_nanoseconds_for(vm, time_zone, instant)); // b. Let timeZoneString be ! FormatISOTimeZoneOffsetString(offsetNs). - time_zone_string = TRY_OR_THROW_OOM(vm, String::from_deprecated_string(format_iso_time_zone_offset_string(offset_ns))); + time_zone_string = MUST_OR_THROW_OOM(format_iso_time_zone_offset_string(vm, offset_ns)); } // 10. Return the string-concatenation of dateTimeString and timeZoneString. diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/TimeZone.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/TimeZone.cpp index 3ca6fe794b..90678659a2 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/TimeZone.cpp +++ b/Userland/Libraries/LibJS/Runtime/Temporal/TimeZone.cpp @@ -264,7 +264,7 @@ ThrowCompletionOr format_time_zone_offset_string(VM& vm, double offset_n } // 11.6.6 FormatISOTimeZoneOffsetString ( offsetNanoseconds ), https://tc39.es/proposal-temporal/#sec-temporal-formatisotimezoneoffsetstring -DeprecatedString format_iso_time_zone_offset_string(double offset_nanoseconds) +ThrowCompletionOr format_iso_time_zone_offset_string(VM& vm, double offset_nanoseconds) { // 1. Assert: offsetNanoseconds is an integer. VERIFY(trunc(offset_nanoseconds) == offset_nanoseconds); @@ -287,7 +287,7 @@ DeprecatedString format_iso_time_zone_offset_string(double offset_nanoseconds) // 7. Let h be ToZeroPaddedDecimalString(hours, 2). // 8. Let m be ToZeroPaddedDecimalString(minutes, 2). // 9. Return the string-concatenation of sign, h, the code unit 0x003A (COLON), and m. - return DeprecatedString::formatted("{}{:02}:{:02}", sign, (u32)hours, (u32)minutes); + return TRY_OR_THROW_OOM(vm, String::formatted("{}{:02}:{:02}", sign, (u32)hours, (u32)minutes)); } // 11.6.7 ToTemporalTimeZone ( temporalTimeZoneLike ), https://tc39.es/proposal-temporal/#sec-temporal-totemporaltimezone diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/TimeZone.h b/Userland/Libraries/LibJS/Runtime/Temporal/TimeZone.h index a091d97129..51eb689857 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/TimeZone.h +++ b/Userland/Libraries/LibJS/Runtime/Temporal/TimeZone.h @@ -43,7 +43,7 @@ ISODateTime get_iso_parts_from_epoch(VM&, Crypto::SignedBigInteger const& epoch_ BigInt* get_named_time_zone_next_transition(VM&, StringView time_zone_identifier, BigInt const& epoch_nanoseconds); BigInt* get_named_time_zone_previous_transition(VM&, StringView time_zone_identifier, BigInt const& epoch_nanoseconds); ThrowCompletionOr format_time_zone_offset_string(VM&, double offset_nanoseconds); -DeprecatedString format_iso_time_zone_offset_string(double offset_nanoseconds); +ThrowCompletionOr format_iso_time_zone_offset_string(VM&, double offset_nanoseconds); ThrowCompletionOr to_temporal_time_zone(VM&, Value temporal_time_zone_like); ThrowCompletionOr get_offset_nanoseconds_for(VM&, Value time_zone, Instant&); ThrowCompletionOr builtin_time_zone_get_offset_string_for(VM&, Value time_zone, Instant&); diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/ZonedDateTime.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/ZonedDateTime.cpp index 7bcb80874c..648ad11a33 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/ZonedDateTime.cpp +++ b/Userland/Libraries/LibJS/Runtime/Temporal/ZonedDateTime.cpp @@ -314,12 +314,12 @@ ThrowCompletionOr temporal_zoned_date_time_to_string(VM& vm, Z // 9. Let dateTimeString be ! TemporalDateTimeToString(temporalDateTime.[[ISOYear]], temporalDateTime.[[ISOMonth]], temporalDateTime.[[ISODay]], temporalDateTime.[[ISOHour]], temporalDateTime.[[ISOMinute]], temporalDateTime.[[ISOSecond]], temporalDateTime.[[ISOMillisecond]], temporalDateTime.[[ISOMicrosecond]], temporalDateTime.[[ISONanosecond]], isoCalendar, precision, "never"). auto date_time_string = MUST_OR_THROW_OOM(temporal_date_time_to_string(vm, temporal_date_time->iso_year(), temporal_date_time->iso_month(), temporal_date_time->iso_day(), temporal_date_time->iso_hour(), temporal_date_time->iso_minute(), temporal_date_time->iso_second(), temporal_date_time->iso_millisecond(), temporal_date_time->iso_microsecond(), temporal_date_time->iso_nanosecond(), iso_calendar, precision, "never"sv)); - DeprecatedString offset_string; + String offset_string; // 10. If showOffset is "never", then if (show_offset == "never"sv) { // a. Let offsetString be the empty String. - offset_string = DeprecatedString::empty(); + offset_string = {}; } // 11. Else, else { @@ -327,7 +327,7 @@ ThrowCompletionOr temporal_zoned_date_time_to_string(VM& vm, Z auto offset_ns = TRY(get_offset_nanoseconds_for(vm, &time_zone, *instant)); // b. Let offsetString be ! FormatISOTimeZoneOffsetString(offsetNs). - offset_string = format_iso_time_zone_offset_string(offset_ns); + offset_string = MUST_OR_THROW_OOM(format_iso_time_zone_offset_string(vm, offset_ns)); } DeprecatedString time_zone_string;