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

p-inputnumber doesn't initialize its value correctly #17314

Open
2 of 4 tasks
realpascuu opened this issue Jan 7, 2025 · 3 comments
Open
2 of 4 tasks

p-inputnumber doesn't initialize its value correctly #17314

realpascuu opened this issue Jan 7, 2025 · 3 comments
Labels
Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible

Comments

@realpascuu
Copy link

realpascuu commented Jan 7, 2025

Describe the bug

Input number doesn't initialize its value correctly.

image

Pull Request Link

No response

Reason for not contributing a PR

  • Lack of time
  • Unsure how to implement the fix/feature
  • Difficulty understanding the codebase
  • Other

Other Reason

No response

Reproducer

https://stackblitz.com/edit/github-bnbvqvg7?file=src%2Fapp%2Fapp.component.ts

Environment

SO: Ubuntu 24.02.1
Locale: es-ES

Angular version

19.0.5

PrimeNG version

v19

Node version

22.12.0

Browser(s)

Chrome 131

Steps to reproduce the behavior

  1. Initialize component with a decimal value.
  2. The input displays the value without decimal.

Example: if you initializes with 23.3, the input displays 233

Expected behavior

  • Display the correct decimal value.
  • Possibility of write decimal values with minFractionDigits = 0.
@realpascuu realpascuu added the Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible label Jan 7, 2025
@imaksp
Copy link

imaksp commented Jan 7, 2025

Looks like some locale specific bug.

@halilyldzs
Copy link

halilyldzs commented Jan 7, 2025

The same happens when the locale is tr-TR. 120.45 is 12,045.00.
image
image

@UrosBgd
Copy link

UrosBgd commented Jan 9, 2025

I can also confirm this bug appears for 'sr' locale, but it's working fine for default one. I suspect it doesn't work for locales using (,) as decimal separator instead of (.), which is actually the most of the Europe.

Steps to reproduce

  • Open the first example from InputNumber docs (https://primeng.org/inputnumber) in Stackblitz.
  • Import 'sr' locale in main.ts file import '@angular/common/locales/global/sr';
  • Provide 'sr' locale in main.ts file { provide: LOCALE_ID, useValue: 'sr' }
  • Update third control html, set locale="sr"
  • Update value3 to 10.1
  • Expected value 10,10, actual value 101,00

I can confirm this worked in v17, since I noticed it because of the failing unit test after migrating to v19.

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

4 participants