add red color
[arvados-workbench2.git] / src / common / formatters.ts
index 1d9a52012445b1478c9dc3b4d37197dd9237bc74..38ef0223e957f1b134d1dfed10c23341af145fbc 100644 (file)
@@ -4,12 +4,13 @@
 
 export const formatDate = (isoDate: string) => {
     const date = new Date(isoDate);
-    return date.toLocaleString();
+    const text = date.toLocaleString();
+    return text === 'Invalid Date' ? "" : text;
 };
 
 export const formatFileSize = (size?: number) => {
     if (typeof size === "number") {
-        for (const { base, unit } of fileSizes) {
+        for (const { base, unit } of FILE_SIZES) {
             if (size >= base) {
                 return `${(size / base).toFixed()} ${unit}`;
             }
@@ -18,7 +19,7 @@ export const formatFileSize = (size?: number) => {
     return "";
 };
 
-const fileSizes = [
+const FILE_SIZES = [
     {
         base: 1000000000000,
         unit: "TB"