15424: Incorporate contents of WelcomePageHTML in login panel
[arvados-workbench2.git] / src / common / formatters.ts
index 5383c66e949f59ee1b2d1258f0d2d1402f485bdb..377e78e42a8678dae93980549bda9c6a10fc8020 100644 (file)
@@ -4,13 +4,19 @@
 
 import { PropertyValue } from "~/models/search-bar";
 
-export const formatDate = (isoDate?: string) => {
+export const formatDate = (isoDate?: string | null, utc: boolean = false) => {
     if (isoDate) {
         const date = new Date(isoDate);
-        const text = date.toLocaleString();
-        return text === 'Invalid Date' ? "" : text;
+        let text: string;
+        if (utc) {
+            text = date.toUTCString();
+        }
+        else {
+            text = date.toLocaleString();
+        }
+        return text === 'Invalid Date' ? "(none)" : text;
     }
-    return "";
+    return "(none)";
 };
 
 export const formatFileSize = (size?: number) => {