mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-05 15:49:11 +00:00
LibJS: Implement stringification Temporal.PlainMonthDay prototypes
This commit is contained in:
parent
1a386e78c3
commit
5bccb36a6f
Notes:
github-actions[bot]
2024-11-22 00:25:37 +00:00
Author: https://github.com/trflynn89
Commit: 5bccb36a6f
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2471
14 changed files with 238 additions and 7 deletions
|
@ -84,6 +84,28 @@ ThrowCompletionOr<Overflow> get_temporal_overflow_option(VM& vm, Object const& o
|
|||
return Overflow::Reject;
|
||||
}
|
||||
|
||||
// 13.10 GetTemporalShowCalendarNameOption ( options ), https://tc39.es/proposal-temporal/#sec-temporal-gettemporalshowcalendarnameoption
|
||||
ThrowCompletionOr<ShowCalendar> get_temporal_show_calendar_name_option(VM& vm, Object const& options)
|
||||
{
|
||||
// 1. Let stringValue be ? GetOption(options, "calendarName", STRING, « "auto", "always", "never", "critical" », "auto").
|
||||
auto string_value = TRY(get_option(vm, options, vm.names.calendarName, OptionType::String, { "auto"sv, "always"sv, "never"sv, "critical"sv }, "auto"sv));
|
||||
|
||||
// 2. If stringValue is "always", return ALWAYS.
|
||||
if (string_value.as_string().utf8_string_view() == "always"sv)
|
||||
return ShowCalendar::Always;
|
||||
|
||||
// 3. If stringValue is "never", return NEVER.
|
||||
if (string_value.as_string().utf8_string_view() == "never"sv)
|
||||
return ShowCalendar::Never;
|
||||
|
||||
// 4. If stringValue is "critical", return CRITICAL.
|
||||
if (string_value.as_string().utf8_string_view() == "critical"sv)
|
||||
return ShowCalendar::Critical;
|
||||
|
||||
// 5. Return AUTO.
|
||||
return ShowCalendar::Auto;
|
||||
}
|
||||
|
||||
// 13.14 ValidateTemporalRoundingIncrement ( increment, dividend, inclusive ), https://tc39.es/proposal-temporal/#sec-validatetemporalroundingincrement
|
||||
ThrowCompletionOr<void> validate_temporal_rounding_increment(VM& vm, u64 increment, u64 dividend, bool inclusive)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue