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

Literal quotes not removed from compact number/currency formats #917

Open
jmaicher opened this issue Mar 10, 2021 · 1 comment
Open

Literal quotes not removed from compact number/currency formats #917

jmaicher opened this issue Mar 10, 2021 · 1 comment
Labels

Comments

@jmaicher
Copy link

jmaicher commented Mar 10, 2021

Hey 👋

As you can see in the following example, literal quotes are not fully removed from compact number/currency formats.

Globalize("de").formatNumber(1_000_000, { compact: "short" });
// => 1 Mio'.'

Globalize("de").formatCurrency(1_000_000, "EUR", { compact: "short" });
// => 1 Mio'.' €

This is a regression that was introduced in 1.5.0 with this commit 8b2a006.

What would be a good approach to fix this? Does it make sense to remove literal quotes specifically from the compact part, or do we need to take more parts into consideration? Literal quotes are already partially removed in stringToParts.

@rxaviers
Copy link
Member

Hi,

Thanks for filing this issue. I agree it makes sense to remove the quotes from the compact part 👍. If you can submit a PR, it will be much appreciated. Thanks

Globalize("de").formatNumberToParts(1_000_000, { compact: "short" });
// > [
//   { type: 'integer', value: '1' },
//   { type: 'literal', value: ' ' },
//   { type: 'compact', value: "Mio'.'" }
// ]

@rxaviers rxaviers added the bug label Aug 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants