aboutsummaryrefslogtreecommitdiff
path: root/src/lib/format.ts
blob: 28aa50f64b50ea1d0c14103004f1c42dbb353621 (plain)
1
2
3
4
5
6
7
8
9
export function decimal(n: number): string {
  const str = n.toString()
  const xs = str.split('.')
  if (xs.length == 2) {
    return `${xs[0]},${xs[1].slice(0, 2).padEnd(2, '0')}`
  } else {
    return `${str},00`
  }
}