Update percentage decimal places
This commit is contained in:
parent
5df576c6be
commit
da7b915cca
|
@ -83,7 +83,7 @@ function Stats({ data }) {
|
|||
of <strong>{formatBytes(totals.bandwidth.all)}</strong> of data to{' '}
|
||||
<strong>{formatNumber(totals.uniques.all)}</strong> unique visitors,{' '}
|
||||
<strong>
|
||||
{formatPercent(totals.requests.cached / totals.requests.all, 0)}%
|
||||
{formatPercent(totals.requests.cached / totals.requests.all, 2)}%
|
||||
</strong>{' '}
|
||||
of which were served from the cache.
|
||||
</p>
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
export default function formatPercent(n, fixed = 1) {
|
||||
return String((n.toPrecision(2) * 100).toFixed(fixed));
|
||||
export default function formatPercent(n, decimals = 1) {
|
||||
return (n * 100).toPrecision(decimals + 2);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue