feat: show total in fiat

This commit is contained in:
Vlad Stan 2023-03-30 12:33:16 +03:00
parent 5942d135b3
commit 39bcbfb035
4 changed files with 72 additions and 8 deletions

View file

@ -48,6 +48,16 @@ function isJson(str) {
}
}
function satOrBtc(val, showUnit = true, showSats = false) {
const value = showSats
? LNbits.utils.formatSat(val)
: val == 0
? 0.0
: (val / 100000000).toFixed(8)
if (!showUnit) return value
return showSats ? value + ' sat' : value + ' BTC'
}
function timeFromNow(time) {
// Get timestamps
let unixTime = new Date(time).getTime()