Round amounts to the nearest integer rather than take the floor
Signed-off-by: Yohann D'ANELLO <ynerant@crans.org>
This commit is contained in:
parent
c4c4e9594f
commit
35ffb36fbd
2 changed files with 3 additions and 3 deletions
|
|
@ -7,8 +7,8 @@
|
|||
* @returns {string}
|
||||
*/
|
||||
function pretty_money (value) {
|
||||
if (value % 100 === 0) { return (value < 0 ? '- ' : '') + Math.floor(Math.abs(value) / 100) + ' €' } else {
|
||||
return (value < 0 ? '- ' : '') + Math.floor(Math.abs(value) / 100) + '.' +
|
||||
if (value % 100 === 0) { return (value < 0 ? '- ' : '') + Math.round(Math.abs(value) / 100) + ' €' } else {
|
||||
return (value < 0 ? '- ' : '') + Math.round(Math.abs(value) / 100) + '.' +
|
||||
(Math.abs(value) % 100 < 10 ? '0' : '') + (Math.abs(value) % 100) + ' €'
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue