diff options
author | Timothy Flynn <trflynn89@pm.me> | 2022-08-30 11:42:02 -0400 |
---|---|---|
committer | Tim Flynn <trflynn89@pm.me> | 2022-08-30 14:26:11 -0400 |
commit | 127b28c940ea2fd4bbce2f94e6726801157684d1 (patch) | |
tree | d63451588d8e4f435ba0f5d831550d7fdd584d3b /Userland/Libraries/LibJS/Runtime | |
parent | cab1cce522e2e795135b8e143a4653276c11f4d7 (diff) | |
download | serenity-127b28c940ea2fd4bbce2f94e6726801157684d1.zip |
LibJS: Use numeric style if the previous style was numeric or 2-digit
This is a normative change in the Intl.DurationFormat proposal. See:
https://github.com/tc39/proposal-intl-duration-format/commit/3a46ee3
Diffstat (limited to 'Userland/Libraries/LibJS/Runtime')
-rw-r--r-- | Userland/Libraries/LibJS/Runtime/Intl/DurationFormat.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/Userland/Libraries/LibJS/Runtime/Intl/DurationFormat.cpp b/Userland/Libraries/LibJS/Runtime/Intl/DurationFormat.cpp index b76cc61beb..2bb1390a9f 100644 --- a/Userland/Libraries/LibJS/Runtime/Intl/DurationFormat.cpp +++ b/Userland/Libraries/LibJS/Runtime/Intl/DurationFormat.cpp @@ -252,7 +252,12 @@ ThrowCompletionOr<DurationUnitOptions> get_duration_unit_options(VM& vm, String // i. Set style to digitalBase. style = digital_base; } - // c. Else, + // c. Else if prevStyle is "numeric" or "2-digit", then + else if (previous_style == "numeric"sv || previous_style == "2-digit"sv) { + // i. Set style to "numeric". + style = "numeric"sv; + } + // d. Else, else { // i. Set style to baseStyle. style = base_style; |