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: (Germany) second step of currency can't changed #5589

Closed
tugcekucukoglu opened this issue Dec 13, 2023 · 4 comments · Fixed by #5608 or #5718
Closed

InputNumber: (Germany) second step of currency can't changed #5589

tugcekucukoglu opened this issue Dec 13, 2023 · 4 comments · Fixed by #5608 or #5718
Assignees
Labels
Type: Bug Issue contains a defect related to a specific component.
Milestone

Comments

@tugcekucukoglu
Copy link
Member

First, delete all the input, type some numbers, and then type a comma. The second step of the currency will not change anymore.

@tugcekucukoglu tugcekucukoglu added the Type: Bug Issue contains a defect related to a specific component. label Dec 13, 2023
@github-actions github-actions bot added the Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible label Dec 13, 2023
@melloware
Copy link
Member

I think this is related: #5548

@kl-nevermore
Copy link
Contributor

kl-nevermore commented Dec 15, 2023

@melloware
It's most likely caused here, If separated by comma the isDecimalSign can't judge correctly
the primeng worked, I still haven't figured out why. The codes seem to be the same
https://github.com/primefaces/primereact/blob/master/components/lib/inputnumber/InputNumber.js#L866C24-L866C24

// isDecimalSign return false
const newSelectionEnd = selectionEnd + Number(isDecimalSign(value) || isDecimalSign(insertedValueStr));

@kl-nevermore
Copy link
Contributor

kl-nevermore commented Dec 16, 2023

How about changing it to this?
@melloware @tugcekucukoglu

const isDecimalSign = (char) => {
    if (_decimal.current.test(char) || _decimal.current.test(char.toString().replace(".",","))) {
        _decimal.current.lastIndex = 0;

        return true;
    }

    return false;
};

@melloware
Copy link
Member

@kl-nevermore but won't that check for decimal or comma regardless of Locale?

@melloware melloware removed the Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible label Dec 18, 2023
@melloware melloware added this to the 10.2.2 milestone Dec 18, 2023
melloware added a commit to melloware/primereact that referenced this issue Jan 9, 2024
melloware added a commit that referenced this issue Jan 9, 2024
* Fix #5537 InputNumber text focus

* Fix #5548
Fix #5589
Fix #5607

* fix:InputNumber: Value pasted by the user is not entered when suffix and decimals are used
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Issue contains a defect related to a specific component.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants