mirror of
https://github.com/status-im/nimbus-gui.git
synced 2025-02-03 07:03:30 +00:00
fix: string prop for to fixed util func
This commit is contained in:
parent
60f6776417
commit
1ce29acc46
@ -39,14 +39,12 @@ export const getFormattedWalletAddress = (address: string) => {
|
||||
return `${address.slice(0, 5)}...${address.slice(-3)}`
|
||||
}
|
||||
|
||||
export const formatToFixed4 = (value: number) => {
|
||||
const str = value.toString()
|
||||
const decimalPart = str.split('.')[1]
|
||||
export const formatToFixed4 = (value: string) => {
|
||||
const decimalPart = value.split('.')[1]
|
||||
const decimalLength = decimalPart ? decimalPart.length : 0
|
||||
|
||||
if (decimalLength > 4) {
|
||||
return value.toFixed(4)
|
||||
return Number(value).toFixed(4)
|
||||
}
|
||||
|
||||
return str
|
||||
return value
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user