Environment
- Package version(s): @blueprintjs/core 6.20.0 (develop at f73386b)
- Operating System: macOS
- Browser name and version: any.
(-1.5).toLocaleString("sv-SE") returns "−1,5", starting with U+2212 MINUS SIGN, in Node 25 and in JavaScriptCore.
Code Sandbox
No sandbox. <NumericInput locale="sv-SE" onValueChange={console.log} /> on its own reproduces it.
Steps to reproduce
- Render
<NumericInput locale="sv-SE" /> with no value.
- Click the decrement button three times.
- Clear the field and paste
−1,5, written with U+2212.
Actual behavior
The field shows 1, then 0, then 1, so the value never goes below zero. The paste gives 1,5 and onValueChange gets 1.5.
In these locales Intl writes negatives with U+2212 instead of -. sanitizeNumericInput keeps only the characters of a floating-point number, so the sign is stripped. Five other locales, among them fi-FI and nb-NO, format negatives the same way.
Expected behavior
-1, -2, -3, and -1,5 for the paste, as with de-DE.
Possible solution
Map U+2212 to - in sanitizeNumericInput, next to the full-width digit conversion. I have a branch with that and two tests and can open a PR.
Environment
(-1.5).toLocaleString("sv-SE")returns"−1,5", starting with U+2212 MINUS SIGN, in Node 25 and in JavaScriptCore.Code Sandbox
No sandbox.
<NumericInput locale="sv-SE" onValueChange={console.log} />on its own reproduces it.Steps to reproduce
<NumericInput locale="sv-SE" />with no value.−1,5, written with U+2212.Actual behavior
The field shows
1, then0, then1, so the value never goes below zero. The paste gives1,5andonValueChangegets1.5.In these locales
Intlwrites negatives with U+2212 instead of-.sanitizeNumericInputkeeps only the characters of a floating-point number, so the sign is stripped. Five other locales, among them fi-FI and nb-NO, format negatives the same way.Expected behavior
-1,-2,-3, and-1,5for the paste, as with de-DE.Possible solution
Map U+2212 to
-insanitizeNumericInput, next to the full-width digit conversion. I have a branch with that and two tests and can open a PR.