From 8394b80f7adb29353846747ffe2709bb2fd2d3d3 Mon Sep 17 00:00:00 2001 From: robobun <117481402+robobun@users.noreply.github.com> Date: Wed, 29 Jul 2026 12:14:13 +0000 Subject: [PATCH] IntlDurationFormat: default minutes/seconds display to "always" when inheriting numeric from prevStyle GetDurationUnitOptions step 3.b.i: when the unit style option is undefined, baseStyle is not "digital", and the previous unit resolved to "numeric"/"2-digit", only units other than "minutes"/"seconds" get displayDefault "auto". Minutes and seconds must keep displayDefault "always" so that a per-unit numeric clock like {hours:"numeric"} produces the full "1:00:00" form rather than "1". Before this change the non-digital branch set displayDefault to Auto unconditionally and only rewrote the inherited style, so the per-unit spelling diverged from the equivalent {style:"digital"} spelling. --- Source/JavaScriptCore/runtime/IntlDurationFormat.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Source/JavaScriptCore/runtime/IntlDurationFormat.cpp b/Source/JavaScriptCore/runtime/IntlDurationFormat.cpp index 8de3d534b903a..e7240843d8d23 100644 --- a/Source/JavaScriptCore/runtime/IntlDurationFormat.cpp +++ b/Source/JavaScriptCore/runtime/IntlDurationFormat.cpp @@ -131,12 +131,13 @@ static IntlDurationFormat::UnitData intlDurationUnitOptions(JSGlobalObject* glob if (unit != TemporalUnit::Hour && unit != TemporalUnit::Minute && unit != TemporalUnit::Second) displayDefault = IntlDurationFormat::Display::Auto; style = digitalBase; + } else if (prevStyle && (prevStyle.value() == IntlDurationFormat::UnitStyle::Numeric || prevStyle.value() == IntlDurationFormat::UnitStyle::TwoDigit)) { + if (unit != TemporalUnit::Minute && unit != TemporalUnit::Second) + displayDefault = IntlDurationFormat::Display::Auto; + style = IntlDurationFormat::UnitStyle::Numeric; } else { displayDefault = IntlDurationFormat::Display::Auto; - if (prevStyle && (prevStyle.value() == IntlDurationFormat::UnitStyle::Numeric || prevStyle.value() == IntlDurationFormat::UnitStyle::TwoDigit)) - style = IntlDurationFormat::UnitStyle::Numeric; - else - style = static_cast(baseStyle); + style = static_cast(baseStyle); } }