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

NumericField formatting error in certain locales #10626

Closed
forsdahl opened this issue Dec 21, 2022 · 2 comments
Closed

NumericField formatting error in certain locales #10626

forsdahl opened this issue Dec 21, 2022 · 2 comments

Comments

@forsdahl
Copy link
Contributor

Affected Version

4.11

Description

NumericField has a formatting error when using the CMS in at least the Swedish and Finnish locales. If you input a number greater than or equal to 1000, the next time the form is saved the number will be empty, or you will get a validation error. This seems to be caused by some problem with the php NumberFormatter and space as grouping separator. If you disable grouping in getFormatter, the problem is resolved:

$formatter->setAttribute(NumberFormatter::GROUPING_USED, false);

The general solution might be to disable number grouping for all locales that have space as the grouping symbol? Like so:

if ($formatter->getSymbol(NumberFormatter::GROUPING_SEPARATOR_SYMBOL) == ' ') {
    $formatter->setAttribute(NumberFormatter::GROUPING_USED, false);
}

Steps to Reproduce

Switch to Swedish locale in the CMS, and try to store a number greater than or equal to 1000 multiple times in any NumericField.

@GuySartorelli
Copy link
Member

This is a duplicate of #6910 - but given this issue has more details, I will close the other one.

@GuySartorelli
Copy link
Member

Closing as a duplicate of #11162 which has an attached PR that got merged.

@GuySartorelli GuySartorelli closed this as not planned Won't fix, can't repro, duplicate, stale Mar 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants