fix dollar formatter
This commit is contained in:
parent
cef2c448e6
commit
651e503a0c
@ -2,7 +2,7 @@ export const formatDollars = (value, cents = true) => {
|
|||||||
if (typeof value === 'number') {
|
if (typeof value === 'number') {
|
||||||
return cents
|
return cents
|
||||||
? `$${value.toFixed(2).replace(/\d(?=(\d{3})+\.)/g, '$&,')}`
|
? `$${value.toFixed(2).replace(/\d(?=(\d{3})+\.)/g, '$&,')}`
|
||||||
: `$${value.toFixed(0).replace(/\d(?=(\d{3}))/g, '$&,')}`
|
: `$${value.toFixed(0).replace(/\d(?=(\d{3})+(?!\d))/g, '$&,')}`
|
||||||
}
|
}
|
||||||
return ''
|
return ''
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user