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

NumberFormat: new option to force sign #163

Closed
ray007 opened this issue Aug 24, 2017 · 5 comments
Closed

NumberFormat: new option to force sign #163

ray007 opened this issue Aug 24, 2017 · 5 comments
Assignees
Labels
c: numbers Component: numbers, currency, units s: in progress Status: the issue has an active proposal

Comments

@ray007
Copy link

ray007 commented Aug 24, 2017

Intl.NumberFormat could use an option to also show a sign ("+") for positive numbers.

@caridy caridy added the s: help wanted Status: help wanted; needs proposal champion label Sep 28, 2017
@caridy
Copy link
Contributor

caridy commented Sep 28, 2017

We need a formal proposal, and a champion :)

@littledan littledan self-assigned this Oct 12, 2017
@littledan
Copy link
Member

This does sound potentially useful. I have a few questions for the next steps:

  • Do you think you could list some cases where you'd want to use this option?
  • Is it really something that you want to be an option that the user chooses, or is this something that turns on in some locales and not in others?
  • How is this option represented in other locale data repositories, e.g., ICU and CLDR?

cc @jungshik

@ray007
Copy link
Author

ray007 commented Oct 13, 2017

  • It may not be needed often, but some of our customer have asked for it. I missed it for formatting ISO8601 timezone offsets.
  • I don't think you'd want this always on, but I don't know enough about most locales to judge that.
  • It's defined in main/{localeId}/numbers.json, key symbols-numberSystem-latn/plusSign

@littledan littledan added the Small Smaller change solvable in a Pull Request label Dec 13, 2017
@sffc sffc added s: in progress Status: the issue has an active proposal c: numbers Component: numbers, currency, units and removed s: help wanted Status: help wanted; needs proposal champion Small Smaller change solvable in a Pull Request labels Mar 19, 2019
@anba
Copy link
Contributor

anba commented Mar 16, 2020

Now possible through the "signDisplay" option:

js> print(new Intl.NumberFormat('en', { signDisplay: "always" }).format(10))                                                
+10

@sffc
Copy link
Contributor

sffc commented Mar 16, 2020

Yep, the proposal is Stage 4 and merged. Closing as Fixed

@sffc sffc closed this as completed Mar 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c: numbers Component: numbers, currency, units s: in progress Status: the issue has an active proposal
Projects
None yet
Development

No branches or pull requests

5 participants