Skip to content

Conversation

@stwrt
Copy link
Contributor

@stwrt stwrt commented Dec 15, 2025

https://bugs.webkit.org/show_bug.cgi?id=191122
rdar://problem/166500013

Reviewed by NOBODY (OOPS!).

Strip trailing zeros from duration strings to improve readability.
For example, "1.0min" now displays as "1min", and "10.00ms" as "10ms".

* Source/WebInspectorUI/UserInterface/Base/Utilities.js:
@stwrt stwrt self-assigned this Dec 15, 2025
@stwrt stwrt added the Web Inspector Bugs related to the WebKit Web Inspector. label Dec 15, 2025
@stwrt
Copy link
Contributor Author

stwrt commented Dec 15, 2025

With patch
Screenshot 2025-12-14 at 5 46 32 PM
Screenshot 2025-12-14 at 5 45 35 PM

@webkit-ews-buildbot webkit-ews-buildbot added the merging-blocked Applied to prevent a change from being merged label Dec 15, 2025
if (higherResolution)
return WI.UIString("%.2fms").format(ms);
return WI.UIString("%.1fms").format(ms);
return WI.UIString("%.2fms").format(ms).replace(/\.?0+(ms)$/, "$1");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we probably dont want to try to manipulate localized strings, as i think in some locales it'd actually be 1,0ms instead of 1.0ms

i think we might be able to add trailingZeroDisplay: "stripIfInteger" to the toLocaleString call in String.standardFormatters instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let me try that out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merging-blocked Applied to prevent a change from being merged Web Inspector Bugs related to the WebKit Web Inspector.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants