mirror of
https://github.com/sudoxnym/habitica-self-host.git
synced 2026-08-03 12:40:00 +00:00
add silver leading zero
This commit is contained in:
parent
c60f6f1c23
commit
939bca1eb9
2 changed files with 3 additions and 2 deletions
|
|
@ -269,7 +269,7 @@ module.exports =
|
|||
###
|
||||
silver: (num) ->
|
||||
if num
|
||||
Math.floor (num - Math.floor(num))*100
|
||||
("0" + Math.floor (num - Math.floor(num))*100).slice -2
|
||||
else
|
||||
return "00"
|
||||
|
||||
|
|
|
|||
|
|
@ -251,4 +251,5 @@ describe 'Helper', ->
|
|||
it 'calculates silver coins', ->
|
||||
expect(helpers.silver(10)).to.eql 0
|
||||
expect(helpers.silver(1.957)).to.eql 95
|
||||
expect(helpers.silver()).to.eql 0
|
||||
expect(helpers.silver(0.01)).to.eql "01"
|
||||
expect(helpers.silver()).to.eql "00"
|
||||
|
|
|
|||
Loading…
Reference in a new issue