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

Currency format without fractional values #9141

Closed
raoulb opened this issue Nov 8, 2021 · 3 comments
Closed

Currency format without fractional values #9141

raoulb opened this issue Nov 8, 2021 · 3 comments

Comments

@raoulb
Copy link
Contributor

raoulb commented Nov 8, 2021

The function lang.FormatCurrency works as expected with 2 or more decimals:

{{ 123 | lang.FormatCurrency 4 "EUR" }} -> 123,0000 €

Sometimes one might wish to get outputs like 123 € f.e. for readability concerns.
These calls:

{{ 123 | lang.FormatCurrency 0 "EUR" }} -> 123,00 €
{{ 123 | lang.FormatCurrency 1 "EUR" }} -> 123,00 €
{{ 123 | lang.FormatCurrency 2 "EUR" }} -> 123,00 €

all give two digits. Instead I would expect the following:

{{ 123 | lang.FormatCurrency 0 "EUR" }} -> 123 €
{{ 123 | lang.FormatCurrency 1 "EUR" }} -> 123,0 €
{{ 123 | lang.FormatCurrency 2 "EUR" }} -> 123,00 €

If for some reason this is not possible, one should extend the documentation explaining precision >= 2.

@raoulb raoulb added the Proposal label Nov 8, 2021
@jmooring
Copy link
Member

jmooring commented Nov 8, 2021

Duplicate of #8858.

Addressed with #8950.

Screen capture

If you think the documentation needs additional clarification, please create an issue or pull request in https://github.com/gohugoio/hugoDocs. Thanks.

@jmooring jmooring closed this as completed Nov 8, 2021
@raoulb
Copy link
Contributor Author

raoulb commented Nov 9, 2021

Never mind. Hidden in plain sight!

Still unfortunate that we can't resolve the "stylistic printing" issue as explained in #8858.

@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 15, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants