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 - MinFractionDigits and MaxFractionDigits no longer respect a value of 0 #15772

Closed
laurz94 opened this issue May 31, 2024 · 0 comments · Fixed by #15775
Closed

InputNumber - MinFractionDigits and MaxFractionDigits no longer respect a value of 0 #15772

laurz94 opened this issue May 31, 2024 · 0 comments · Fixed by #15775
Labels
LTS-PORTABLE Issue's fix will be ported to supported LTS versions Type: Bug Issue contains a bug related to a specific component. Something about the component is not working
Milestone

Comments

@laurz94
Copy link

laurz94 commented May 31, 2024

Describe the bug

When setting the min and max fraction digits to 0 to show the number as an integer, the control will display the number with 2 digits.

This is broken after this PR merged in 17.18.0
https://github.com/primefaces/primeng/pull/15660/files

The issue seems to be 0 being a falsey value, so the min and max resolve to undefined, so it falls back to Intl.NumberFormat options.

Proposed Resolution (lines 561-562):
minimumFractionDigits: this.minFractionDigits ?? undefined,
maximumFractionDigits: this.maxFractionDigits ?? undefined

Environment

Normal.

Reproducer

https://stackblitz.com/run?file=src%2Fapp%2Finput-number-numerals-demo.ts,src%2Fapp%2Finput-number-numerals-demo.html

Angular version

17

PrimeNG version

17.18.0

Build / Runtime

Angular CLI App

Language

TypeScript

Node version (for AoT issues node --version)

18 LTS

Browser(s)

No response

Steps to reproduce the behavior

Set your min and max fraction digits to 0. See the value not being respected. This is visible in the stackblitz on https://primeng.org/inputnumber

Expected behavior

The number is displayed as a whole number. All number formats are broken (integer, currency, and decimal)

@laurz94 laurz94 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 31, 2024
@cetincakiroglu cetincakiroglu added Type: Bug Issue contains a bug related to a specific component. Something about the component is not working and removed Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible labels Jun 13, 2024
@cetincakiroglu cetincakiroglu added this to the 17.18.1 milestone Jun 13, 2024
@mehmetcetin01140 mehmetcetin01140 added LTS-PORTABLE Issue's fix will be ported to supported LTS versions LTS-FIXED-16.9.11 labels Jun 14, 2024
mehmetcetin01140 added a commit that referenced this issue Nov 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
LTS-PORTABLE Issue's fix will be ported to supported LTS versions Type: Bug Issue contains a bug related to a specific component. Something about the component is not working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants