1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 22:57:44 +00:00

LibJS: Implement Temporal.TimeZone.prototype.getInstantFor()

This commit is contained in:
Linus Groh 2021-11-01 14:20:06 +01:00
parent 55e1edd51b
commit 97f6c6029f
15 changed files with 341 additions and 0 deletions

View file

@ -200,6 +200,18 @@ ThrowCompletionOr<String> to_temporal_overflow(GlobalObject& global_object, Obje
return option.as_string().string();
}
// 13.7 ToTemporalDisambiguation ( normalizedOptions ), https://tc39.es/proposal-temporal/#sec-temporal-totemporaldisambiguation
ThrowCompletionOr<String> to_temporal_disambiguation(GlobalObject& global_object, Object const& normalized_options)
{
auto& vm = global_object.vm();
// 1. Return ? GetOption(normalizedOptions, "disambiguation", « String », « "compatible", "earlier", "later", "reject" », "compatible").
auto option = TRY(get_option(global_object, normalized_options, vm.names.disambiguation, { OptionType::String }, { "compatible"sv, "earlier"sv, "later"sv, "reject"sv }, js_string(vm, "compatible")));
VERIFY(option.is_string());
return option.as_string().string();
}
// 13.8 ToTemporalRoundingMode ( normalizedOptions, fallback ), https://tc39.es/proposal-temporal/#sec-temporal-totemporalroundingmode
ThrowCompletionOr<String> to_temporal_rounding_mode(GlobalObject& global_object, Object const& normalized_options, String const& fallback)
{