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

NumberInput handles big number in an unexpected way #7033

Closed
1 of 2 tasks
Benjaminsson opened this issue Oct 25, 2024 · 3 comments
Closed
1 of 2 tasks

NumberInput handles big number in an unexpected way #7033

Benjaminsson opened this issue Oct 25, 2024 · 3 comments
Labels
Fixed patch Completed issues that will be published with next patch (1.0.X)

Comments

@Benjaminsson
Copy link

Benjaminsson commented Oct 25, 2024

Dependencies check up

  • I have verified that I use latest version of all @mantine/* packages

What version of @mantine/* packages do you have in package.json?

7.13.4

What package has an issue?

@mantine/core

What framework do you use?

Vite

In which browsers you can reproduce the issue?

Chrome

Describe the bug

Big numbers 10_000_000_000_000 and above gets reset when incrementing it.

CleanShot.2024-10-25.at.14.09.29.mp4

I don't know if that is expected behaviour but it gets a little extra weird if you have a max amount. Then maybe it should default to the max amount?

CleanShot.2024-10-25.at.14.13.58.mp4

Not sure if this is related but the number -0 defaults to 0 while just a regular 0 defaults to what you defined in the min prop.

CleanShot.2024-10-25.at.14.29.51.mp4

If possible, include a link to a codesandbox with a minimal reproduction

https://codesandbox.io/p/sandbox/focused-dawn-zrsz64

Possible fix

No response

Self-service

  • I would be willing to implement a fix for this issue
@Kenzo-Wada
Copy link
Contributor

I think this is a issue of react-number-format

rtivital added a commit that referenced this issue Nov 16, 2024
…lue cannot be safely incremented (is larger than Number.MAX_SAFE_INTEGER) (#7033)
@rtivital rtivital added the Fixed patch Completed issues that will be published with next patch (1.0.X) label Nov 16, 2024
@rtivital
Copy link
Member

I've implemented a fix for this in the next patch. The issue is that numbers larger than Number.MAX_SAFE_INTEGER cannot be correctly incremented/decremented with the standard js operators (-/+). It would require a lot of code and possibly a third-party library to support this feature, so currently it is not planned to be implemented. Instead, starting from the next patch 7.14.1, increment/decrement controls will be hidden when the value cannot be safely incremented/decremented.

@rtivital
Copy link
Member

Fixed in 7.14.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Fixed patch Completed issues that will be published with next patch (1.0.X)
Projects
None yet
Development

No branches or pull requests

3 participants