17426: Add dialog box with form to example plugin.
[arvados-workbench2.git] / src / common / formatters.ts
index 1386338c900197a2aa2d918f11a02195d6e88729..17917127f1c26ac18221f8b34a2efcfd6413da5f 100644 (file)
@@ -22,13 +22,15 @@ 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}`;
             }
         }
     }
-    return "";
+    return "0 B";
 };
 
 export const formatTime = (time: number, seconds?: boolean) => {