openexchangerates / accounting.js

A lightweight JavaScript library for number, money and currency formatting - fully localisable, zero dependencies.
http://openexchangerates.github.io/accounting.js
MIT License
4.95k stars 532 forks source link

Ability to specify 'zero' value for currency, eg. " - " #16

Closed wjcrowcroft closed 13 years ago

wjcrowcroft commented 13 years ago

In some accounting systems (and excel formatting), zero values are given as -, eg:

$ 1,000,000
$     1,100
$        -

This would be given in the settings, eg:

currency: {
    zero: " - "
}

Implementing this would mess with formatColumn in its current state, but that method will probably be rewritten soon to make it more robust.

wjcrowcroft commented 13 years ago

Added in v0.2, eg:

format: {
    pos: "%s%v",
    neg: "%s-%v",
    zero: "%s --"
}