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

Add number helper #4

Open
Fauntleroy opened this issue Sep 19, 2013 · 1 comment
Open

Add number helper #4

Fauntleroy opened this issue Sep 19, 2013 · 1 comment
Labels

Comments

@Fauntleroy
Copy link
Contributor

The number helper should provide a set of tools for turning a number into a string representation of the number. Numbers like 1000 can be converted to formats like: 1,000, one thousand, 1k, or 1,000.00.

dollars

1000

Handlebars

<!-- Number with no arguments -->
${{#number dollars}}
<!-- Number with format argument: quantity -->
${{#number dollars quantity}}
<!-- Number with format argument: word -->
{{#number dollars word}} dollars
<!-- Number with format argument: short -->
${{#number dollars short}}
<!-- Number with format and decimal arguments -->
${{#number dollars quantity 2}}

Output

<!-- Number with no arguments -->
$1,000
<!-- Number with format argument: quantity -->
$1,000
<!-- Number with format argument: word -->
one thousand dollars
<!-- Number with format argument: short -->
$1k
<!-- Number with format and decimal arguments -->
$1,000.00
@monika
Copy link

monika commented Jul 16, 2014

If we continue to work with Rally - we'd need something that can insert a decimal point. Rally provides currency as a whole integer, lacking any decimal point to denote cents.

causes: {
    name: "Country Music Hall Of Fame",
    total_raised: 1227800,
    donation_count: 300,
    current_fundraising_goal: 1500000,
    headline: "Let's rally for Country Music Hall Of Fame",
    raised_toward_fundraising_goal: 1227800
}

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