fix: percents incorrectly formatted for locale ru #2939
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Closes #2938
Stand
Note
Adjusts
formatPercentto round as a number and pass numeric value toconfiguredNumeral, fixing locale issues (e.g., ru) and handling very small numbers.src/utils/dataFormatters/dataFormatters.ts:formatPercentto round usingNumber(value.toFixed(precision))and pass a numeric value toconfiguredNumeral.0.[00]%format while improving handling of very small numbers and locale-specific decimal separators.Written by Cursor Bugbot for commit 38c83be. This will update automatically on new commits. Configure here.
Greptile Overview
Updated On: 2025-09-29 22:02:10 UTC
Summary
This PR fixes a locale-specific formatting issue in the
formatPercentfunction where percentages were incorrectly formatted for the Russian locale. The root cause was passing string values toconfiguredNumeralwhich caused issues with decimal separator parsing in non-English locales.Key Changes:
formatPercentto pass numeric values instead of strings toconfiguredNumeral0.[00]%format while ensuring proper locale handlingTechnical Impact:
The fix ensures that percentage values display correctly across all supported locales, particularly Russian, where decimal separators differ from English conventions. This change affects any UI component that displays percentage values in the YDB Embedded UI.
Confidence Score: 5/5
Important Files Changed
File Analysis
Sequence Diagram
sequenceDiagram participant C as Client Code participant FP as formatPercent participant CN as configuredNumeral participant NL as Numeral Library Note over C,NL: Before Fix C->>FP: formatPercent(0.001234) FP->>FP: Number(0.001234).toFixed(2) → "0.00" FP->>CN: configuredNumeral("0.00") CN->>NL: numeral("0.00") with ru locale Note over NL: String parsing with ru locale<br/>may misinterpret decimal separator NL-->>CN: Potential parsing issues CN-->>FP: Incorrectly formatted result FP-->>C: Wrong percentage format Note over C,NL: After Fix C->>FP: formatPercent(0.001234) FP->>FP: Number(0.001234).toFixed(2) → "0.00" FP->>FP: Number("0.00") → 0.00 FP->>CN: configuredNumeral(0.00) CN->>NL: numeral(0.00) with ru locale Note over NL: Numeric input avoids<br/>locale decimal separator issues NL-->>CN: Correctly parsed number CN-->>FP: Properly formatted result FP-->>C: Correct "0.00%" formatCI Results
Test Status:⚠️ FLAKY
📊 Full Report
Test Changes Summary ⏭️2
⏭️ Skipped Tests (2)
Bundle Size: ✅
Current: 85.61 MB | Main: 85.61 MB
Diff: +0.00 KB (0.00%)
✅ Bundle size unchanged.
ℹ️ CI Information