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

InputNumber: maxFractionDigits default is 0 and the documentation says it's 3 #5753

Open
IlyaSemenov opened this issue May 17, 2024 · 2 comments
Labels
Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible

Comments

@IlyaSemenov
Copy link

Describe the bug

InputNumber's maxFractionDigits documentation says: "the default for plain number formatting is the larger of minimumFractionDigits and 3;".

This is however clearly not true. <InputNumber> will not accept any fractional numbers unless maxFractionDigits is specifically set to something.

Reproducer

https://codesandbox.io/p/devbox/upbeat-darkness-j87x8q

PrimeVue version

3.29.0

Vue version

3.x

Language

ALL

Build / Runtime

Vite

Browser(s)

No response

Steps to reproduce the behavior

  1. Add <InputNumber v-model="value" />
  2. Type 123.456 - it won't accept any fractional numbers

Expected behavior

It should work according to the documentation. Either allow 3 fractional digits by default, or the documentation should be updated to reflect the current default of 0.

@IlyaSemenov IlyaSemenov added the Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible label May 17, 2024
@m-meier
Copy link
Contributor

m-meier commented May 21, 2024

The default value for maxFractionDigits is "null" as seen in the "Default" column of the API. The section you quote references the formatting of the value option, not the allowed input. If you have e.g. '5.12341' in your model value and enable format it will only show '5.123' by default and only more if you increase the maxFractionalDigits parameter.
See here for an example: https://codesandbox.io/p/devbox/primevue-inputnumber-decimals-forked-xkljjv?workspaceId=5ecc5d0e-e789-4dbb-80ba-89addaa3bd1f

@IlyaSemenov
Copy link
Author

So by default it will format 5.12341 as 5.123 but will only allow to change it to 4 or 6, correct? I agree that I misinterpreted the documentation but still the current behavior is a bit odd.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible
Projects
None yet
Development

No branches or pull requests

2 participants