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

LibJS: Implement Temporal.PlainDate.prototype.toString()

This commit is contained in:
Linus Groh 2021-08-18 21:15:04 +01:00 committed by Andreas Kling
parent 310192f918
commit 402f04c2fc
10 changed files with 164 additions and 0 deletions

View file

@ -195,6 +195,20 @@ Optional<String> to_temporal_rounding_mode(GlobalObject& global_object, Object&
return option.as_string().string();
}
// 13.11 ToShowCalendarOption ( normalizedOptions ), https://tc39.es/proposal-temporal/#sec-temporal-toshowcalendaroption
Optional<String> to_show_calendar_option(GlobalObject& global_object, Object& normalized_options)
{
auto& vm = global_object.vm();
// 1. Return ? GetOption(normalizedOptions, "calendarName", « String », « "auto", "always", "never" », "auto").
auto option = get_option(global_object, normalized_options, vm.names.calendarName, { OptionType::String }, { "auto"sv, "always"sv, "never"sv }, js_string(vm, "auto"sv));
if (vm.exception())
return {};
VERIFY(option.is_string());
return option.as_string().string();
}
// 13.14 ToTemporalRoundingIncrement ( normalizedOptions, dividend, inclusive ), https://tc39.es/proposal-temporal/#sec-temporal-totemporalroundingincrement
u64 to_temporal_rounding_increment(GlobalObject& global_object, Object& normalized_options, Optional<double> dividend, bool inclusive)
{