Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NumberParser: Incorrect Parsing of Comma-Separated Number Strings #7420

Open
tihcamos opened this issue Nov 21, 2024 · 0 comments
Open

NumberParser: Incorrect Parsing of Comma-Separated Number Strings #7420

tihcamos opened this issue Nov 21, 2024 · 0 comments

Comments

@tihcamos
Copy link

Provide a general summary of the issue here

When using the NumberParser from @internationalized/number, I encountered an issue where the string '1,1,1.2' is being parsed incorrectly as 111.2.

🤔 Expected Behavior?

The input string '1,1,1.2' should throw a parsing error (since it is not a valid number format in any locale),

😯 Current Behavior

The input string '1,1,1.2' is parsed as 111.2, which appears to ignore the commas inappropriately and concatenate the numbers.

💁 Possible Solution

No response

🔦 Context

No response

🖥️ Steps to Reproduce

  1. Import and initialize NumberParser:
    import { NumberParser } from '@internationalized/number';
    
    const parser = new NumberParser('en-US'); // Example locale
    const result = parser.parse('1,1,1.2');
    console.log(result); // Outputs: 111.2
  2. Observe that the output is 111.2 instead of an error or a correctly parsed value.

Version

3.5.4

What browsers are you seeing the problem on?

Chrome

If other, please specify.

No response

What operating system are you using?

Windows 11

🧢 Your Company/Team

No response

🕷 Tracking Issue

No response

@tihcamos tihcamos changed the title NumberParser does not work as expected NumberParser: Incorrect Parsing of Comma-Separated Number Strings Nov 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant