From a7f1974b6dc5f26da1e3c6c2d260c384b33446b0 Mon Sep 17 00:00:00 2001 From: David Straub Date: Mon, 30 Oct 2023 11:22:48 +0100 Subject: [PATCH] Fix 0 bytes display bug (fixes #299) --- src/components/GrampsjsTreeQuotas.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/components/GrampsjsTreeQuotas.js b/src/components/GrampsjsTreeQuotas.js index 72c123d4..730cb9f4 100644 --- a/src/components/GrampsjsTreeQuotas.js +++ b/src/components/GrampsjsTreeQuotas.js @@ -22,6 +22,9 @@ function formatBytes(bytes) { if (bytes === null) { return null } + if (bytes === 0) { + return '0 B' + } const prefixes = ['', 'k', 'M', 'G', 'T', 'P', 'E', 'Z', 'Y'] const base = 1000 const exponent = Math.floor(Math.log10(bytes) / Math.log10(base))