1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 19:27:45 +00:00

LibJS: Port to_show_offset_option() to String

This commit is contained in:
Linus Groh 2023-01-26 12:20:18 +00:00
parent ddd5d8531b
commit f928c7754d
2 changed files with 3 additions and 3 deletions

View file

@ -264,13 +264,13 @@ ThrowCompletionOr<String> to_time_zone_name_option(VM& vm, Object const& normali
} }
// 13.11 ToShowOffsetOption ( normalizedOptions ), https://tc39.es/proposal-temporal/#sec-temporal-toshowoffsetoption // 13.11 ToShowOffsetOption ( normalizedOptions ), https://tc39.es/proposal-temporal/#sec-temporal-toshowoffsetoption
ThrowCompletionOr<DeprecatedString> to_show_offset_option(VM& vm, Object const& normalized_options) ThrowCompletionOr<String> to_show_offset_option(VM& vm, Object const& normalized_options)
{ {
// 1. Return ? GetOption(normalizedOptions, "offset", "string", « "auto", "never" », "auto"). // 1. Return ? GetOption(normalizedOptions, "offset", "string", « "auto", "never" », "auto").
auto option = TRY(get_option(vm, normalized_options, vm.names.offset, OptionType::String, { "auto"sv, "never"sv }, "auto"sv)); auto option = TRY(get_option(vm, normalized_options, vm.names.offset, OptionType::String, { "auto"sv, "never"sv }, "auto"sv));
VERIFY(option.is_string()); VERIFY(option.is_string());
return TRY(option.as_string().deprecated_string()); return option.as_string().utf8_string();
} }
// 13.12 ToTemporalRoundingIncrement ( normalizedOptions, dividend, inclusive ), https://tc39.es/proposal-temporal/#sec-temporal-totemporalroundingincrement // 13.12 ToTemporalRoundingIncrement ( normalizedOptions, dividend, inclusive ), https://tc39.es/proposal-temporal/#sec-temporal-totemporalroundingincrement

View file

@ -142,7 +142,7 @@ StringView negate_temporal_rounding_mode(StringView rounding_mode);
ThrowCompletionOr<String> to_temporal_offset(VM&, Object const* options, StringView fallback); ThrowCompletionOr<String> to_temporal_offset(VM&, Object const* options, StringView fallback);
ThrowCompletionOr<String> to_calendar_name_option(VM&, Object const& normalized_options); ThrowCompletionOr<String> to_calendar_name_option(VM&, Object const& normalized_options);
ThrowCompletionOr<String> to_time_zone_name_option(VM&, Object const& normalized_options); ThrowCompletionOr<String> to_time_zone_name_option(VM&, Object const& normalized_options);
ThrowCompletionOr<DeprecatedString> to_show_offset_option(VM&, Object const& normalized_options); ThrowCompletionOr<String> to_show_offset_option(VM&, Object const& normalized_options);
ThrowCompletionOr<u64> to_temporal_rounding_increment(VM&, Object const& normalized_options, Optional<double> dividend, bool inclusive); ThrowCompletionOr<u64> to_temporal_rounding_increment(VM&, Object const& normalized_options, Optional<double> dividend, bool inclusive);
ThrowCompletionOr<u64> to_temporal_date_time_rounding_increment(VM&, Object const& normalized_options, StringView smallest_unit); ThrowCompletionOr<u64> to_temporal_date_time_rounding_increment(VM&, Object const& normalized_options, StringView smallest_unit);
ThrowCompletionOr<SecondsStringPrecision> to_seconds_string_precision(VM&, Object const& normalized_options); ThrowCompletionOr<SecondsStringPrecision> to_seconds_string_precision(VM&, Object const& normalized_options);