summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibJS/Runtime/Intl/DateTimeFormatConstructor.cpp
diff options
context:
space:
mode:
authorTimothy Flynn <trflynn89@pm.me>2023-01-15 10:31:39 -0500
committerLinus Groh <mail@linusgroh.de>2023-01-16 10:12:37 +0000
commitfc413711eeb17558dff5138a67360f24ef87e34e (patch)
treec89ef0a2f27340d17c15fb6c145e85d6c3a889e9 /Userland/Libraries/LibJS/Runtime/Intl/DateTimeFormatConstructor.cpp
parentedfdade9e94342c1828e99c2c89dff32eaa4b070 (diff)
downloadserenity-fc413711eeb17558dff5138a67360f24ef87e34e.zip
LibJS: Port trivial use cases in the Intl namespace to String
Diffstat (limited to 'Userland/Libraries/LibJS/Runtime/Intl/DateTimeFormatConstructor.cpp')
-rw-r--r--Userland/Libraries/LibJS/Runtime/Intl/DateTimeFormatConstructor.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/Userland/Libraries/LibJS/Runtime/Intl/DateTimeFormatConstructor.cpp b/Userland/Libraries/LibJS/Runtime/Intl/DateTimeFormatConstructor.cpp
index 8b1e31cc59..7c61b9e5f6 100644
--- a/Userland/Libraries/LibJS/Runtime/Intl/DateTimeFormatConstructor.cpp
+++ b/Userland/Libraries/LibJS/Runtime/Intl/DateTimeFormatConstructor.cpp
@@ -106,7 +106,7 @@ ThrowCompletionOr<DateTimeFormat*> initialize_date_time_format(VM& vm, DateTimeF
// 7. If calendar is not undefined, then
if (!calendar.is_undefined()) {
// a. If calendar does not match the Unicode Locale Identifier type nonterminal, throw a RangeError exception.
- if (!::Locale::is_type_identifier(TRY(calendar.as_string().deprecated_string())))
+ if (!::Locale::is_type_identifier(TRY(calendar.as_string().utf8_string_view())))
return vm.throw_completion<RangeError>(ErrorType::OptionIsNotValidValue, calendar, "calendar"sv);
// 8. Set opt.[[ca]] to calendar.
@@ -119,7 +119,7 @@ ThrowCompletionOr<DateTimeFormat*> initialize_date_time_format(VM& vm, DateTimeF
// 10. If numberingSystem is not undefined, then
if (!numbering_system.is_undefined()) {
// a. If numberingSystem does not match the Unicode Locale Identifier type nonterminal, throw a RangeError exception.
- if (!::Locale::is_type_identifier(TRY(numbering_system.as_string().deprecated_string())))
+ if (!::Locale::is_type_identifier(TRY(numbering_system.as_string().utf8_string_view())))
return vm.throw_completion<RangeError>(ErrorType::OptionIsNotValidValue, numbering_system, "numberingSystem"sv);
// 11. Set opt.[[nu]] to numberingSystem.
@@ -277,7 +277,7 @@ ThrowCompletionOr<DateTimeFormat*> initialize_date_time_format(VM& vm, DateTimeF
// d. Set formatOptions.[[<prop>]] to value.
if (!value.is_undefined()) {
- option = ::Locale::calendar_pattern_style_from_string(TRY(value.as_string().deprecated_string()));
+ option = ::Locale::calendar_pattern_style_from_string(TRY(value.as_string().utf8_string_view()));
// e. If value is not undefined, then
// i. Set hasExplicitFormatComponents to true.
@@ -296,14 +296,14 @@ ThrowCompletionOr<DateTimeFormat*> initialize_date_time_format(VM& vm, DateTimeF
// 39. Set dateTimeFormat.[[DateStyle]] to dateStyle.
if (!date_style.is_undefined())
- date_time_format.set_date_style(TRY(date_style.as_string().deprecated_string()));
+ date_time_format.set_date_style(TRY(date_style.as_string().utf8_string_view()));
// 40. Let timeStyle be ? GetOption(options, "timeStyle", string, ยซ "full", "long", "medium", "short" ยป, undefined).
auto time_style = TRY(get_option(vm, *options, vm.names.timeStyle, OptionType::String, AK::Array { "full"sv, "long"sv, "medium"sv, "short"sv }, Empty {}));
// 41. Set dateTimeFormat.[[TimeStyle]] to timeStyle.
if (!time_style.is_undefined())
- date_time_format.set_time_style(TRY(time_style.as_string().deprecated_string()));
+ date_time_format.set_time_style(TRY(time_style.as_string().utf8_string_view()));
Optional<::Locale::CalendarPattern> best_format {};
@@ -325,7 +325,7 @@ ThrowCompletionOr<DateTimeFormat*> initialize_date_time_format(VM& vm, DateTimeF
auto formats = ::Locale::get_calendar_available_formats(data_locale, date_time_format.calendar());
// b. If matcher is "basic", then
- if (TRY(matcher.as_string().deprecated_string()) == "basic"sv) {
+ if (TRY(matcher.as_string().utf8_string_view()) == "basic"sv) {
// i. Let bestFormat be BasicFormatMatcher(formatOptions, formats).
best_format = basic_format_matcher(format_options, move(formats));
}