primeng icon indicating copy to clipboard operation
primeng copied to clipboard

p-inputNumber: Emits number while changing but string when losing focus

Open jpgoelz opened this issue 2 years ago • 6 comments

Describe the bug

When changing the content of a p-inputNumber, the emitted value correctly is of type number. But as soon as the input loses focus the type changes to string, which may lead too hard to find typing problems.

Environment

Any environment should have this problem. I tested this with the documentation demo StackBlitz (see below).

Reproducer

https://stackblitz.com/edit/m96pfg?file=src%2Fapp%2Fdemo%2Finput-number-numerals-demo.html

Angular version

17.2.2

PrimeNG version

17.10.0

Build / Runtime

Angular CLI App

Language

TypeScript

Node version (for AoT issues node --version)

n/a

Browser(s)

Chrome

Steps to reproduce the behavior

In my StackBlitz, change the values of the input fields and see the output below:

numberInput-produces-string

Expected behavior

The emitted type is always number (and maybe undefined/null, if input is empty).

jpgoelz avatar Mar 13 '24 14:03 jpgoelz

Hello, I have the same problem, let's hope they fix it in version 17.11.0

dl3g0 avatar Mar 13 '24 17:03 dl3g0

I'm also experiencing this issue. This seems to be introduced in 17.9.0, as far as I can tell by this change: https://github.com/primefaces/primeng/commit/82a4050b6cc5a5891e6ba177a0f0d9143c8bb635#diff-d15eb5f971fcc845ef140641bb6498419d87b06832dd22180381101c84f55a70R1369

gerardva avatar Mar 14 '24 16:03 gerardva

I'm also experiencing this issue. This seems to be introduced in 17.9.0, as far as I can tell by this change: 82a4050#diff-d15eb5f971fcc845ef140641bb6498419d87b06832dd22180381101c84f55a70R1369

That could also explain, why I keep seeing this Error in my console when emptying the input field:
image

jpgoelz avatar Mar 14 '24 16:03 jpgoelz

The issue seems to be resolved in PrimeNG 17.11.0:

https://stackblitz.com/edit/m96pfg-zf4xhr?file=src%2Fapp%2Fdemo%2Finput-number-numerals-demo.ts

jpgoelz avatar Mar 14 '24 19:03 jpgoelz

This issue has been automatically marked as stale. If this issue is still affecting you with the latest version, please leave any comment, and we will keep it open. We are sorry that we have not been able to prioritize it yet. If you have any new additional information, please include it with your comment!

github-actions[bot] avatar Jul 17 '24 01:07 github-actions[bot]

Closing this issue after a prolonged period of inactivity. If this issue is still present in the latest release, please create a new issue with up-to-date information. Thank you for your understanding!

github-actions[bot] avatar Jul 24 '24 01:07 github-actions[bot]