projects
/
arvados-workbench2.git
/ blobdiff
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
| inline |
side by side
13494: Fixes edge case on file size formatter.
[arvados-workbench2.git]
/
src
/
common
/
formatters.ts
diff --git
a/src/common/formatters.ts
b/src/common/formatters.ts
index 55fb050738af1d670984b9c6b38cc3f8bafb7ddc..17917127f1c26ac18221f8b34a2efcfd6413da5f 100644
(file)
--- a/
src/common/formatters.ts
+++ b/
src/common/formatters.ts
@@
-22,6
+22,8
@@
export const formatDate = (isoDate?: string | null, utc: boolean = false) => {
export const formatFileSize = (size?: number) => {
if (typeof size === "number") {
+ if (size === 0) { return "0 B"; }
+
for (const { base, unit } of FILE_SIZES) {
if (size >= base) {
return `${(size / base).toFixed()} ${unit}`;