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

20.12 update changed Norwegian currency output of Intl NumberFormat.format(price); #52376

Closed
marijaduvnjak opened this issue Apr 5, 2024 · 3 comments
Labels
icu Issues and PRs related to the ICU dependency.

Comments

@marijaduvnjak
Copy link

marijaduvnjak commented Apr 5, 2024

Version

20.12.0

Platform

Linux, Mac

Subsystem

No response

What steps will reproduce the bug?

in Node 20.9, 20.10, 20.11:

const numberFormat = new Intl.NumberFormat('no-NO', { currency: 'NOK', style: 'currency', maximumFractionDigits: 0 });
numberFormat.format(10);
> 'kr 10' // What I expect

in Node 20.12:

const numberFormat = new Intl.NumberFormat('no-NO', { currency: 'NOK', style: 'currency', maximumFractionDigits: 0 });
numberFormat.format(10);
> '10 kr' // What I get

After the 20.12 update, the price formatting changed - kr doesn't always precede the amount.
image

How often does it reproduce? Is there a required condition?

I noticed this during running unit tests. 95% of the time it returns '10 kr' and when you rerun tests multiple times you will end up with the correct price format 'kr 10'.
In application, it causes a hydration error and it always reproduces.

What is the expected behavior? Why is that the expected behavior?

The expected behavior is that this new version update is not a breaking change or at least that there is info that this is a breaking change.
However, this should not be changed as I'm not sure the Norwegians started to show their prices suddenly in a different format.
I'm expecting this:

const numberFormat = new Intl.NumberFormat('no-NO', { currency: 'NOK', style: 'currency', maximumFractionDigits: 0 });
numberFormat.format(10);
> 'kr 10' // => This is how it should look like. 
// And if you try to write this in the browser console you will get the correct price format:
// Intl.NumberFormat('no-NO', { currency: 'NOK', style: 'currency', minimumFractionDigits: 0}).format(10) => 'kr 10'

What do you see instead?

I see this instead:

const numberFormat = new Intl.NumberFormat('no-NO', { currency: 'NOK', style: 'currency', maximumFractionDigits: 0 });
numberFormat.format(10);
> '10 kr' // => I'm getting price format with switched places of currency and amount

Additional information

No response

@VoltrexKeyva VoltrexKeyva added the icu Issues and PRs related to the ICU dependency. label Apr 6, 2024
@kihlstrom
Copy link

The same problem exists for Node version 18.20.0 and 18.20.1 as well (works as expected in 18.19)

@targos
Copy link
Member

targos commented Apr 8, 2024

This is a duplicate of #52258, #52244 and other issues.

This kind of changes are expected when ICU is updated and browsers also make them (Chrome Canary has the new behavior too).

@targos targos closed this as not planned Won't fix, can't repro, duplicate, stale Apr 8, 2024
@Nettsentrisk
Copy link

Seeing this on my end as well. So that means browsers are going to eventually show the same style as Node 20 for placement of the currency symbol for Norwegian?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
icu Issues and PRs related to the ICU dependency.
Projects
None yet
Development

No branches or pull requests

5 participants