15088: Changes link account dispplay times to UTC
authorEric Biagiotti <ebiagiotti@veritasgenetics.com>
Wed, 8 May 2019 15:39:33 +0000 (11:39 -0400)
committerEric Biagiotti <ebiagiotti@veritasgenetics.com>
Wed, 8 May 2019 15:39:33 +0000 (11:39 -0400)
Arvados-DCO-1.1-Signed-off-by: Eric Biagiotti <ebiagiotti@veritasgenetics.com>

src/common/formatters.ts
src/views/link-account-panel/link-account-panel-root.tsx

index 60e6cd59c53e284a929cd6143c618020537ffd3a..377e78e42a8678dae93980549bda9c6a10fc8020 100644 (file)
@@ -4,10 +4,16 @@
 
 import { PropertyValue } from "~/models/search-bar";
 
-export const formatDate = (isoDate?: string | null) => {
+export const formatDate = (isoDate?: string | null, utc: boolean = false) => {
     if (isoDate) {
         const date = new Date(isoDate);
-        const text = date.toLocaleString();
+        let text: string;
+        if (utc) {
+            text = date.toUTCString();
+        }
+        else {
+            text = date.toLocaleString();
+        }
         return text === 'Invalid Date' ? "(none)" : text;
     }
     return "(none)";
index 88730b891d3b05aad23aeffdcb53a2ba6cd29bff..50a8b7cafc09b07e35f3f05e3e6f680b32b5c4fb 100644 (file)
@@ -44,7 +44,7 @@ function displayUser(user: UserResource, showCreatedAt: boolean = false) {
     const disp = [];
     disp.push(<span><b>{user.email}</b> ({user.username}, {user.uuid})</span>);
     if (showCreatedAt) {
-        disp.push(<span> created on <b>{formatDate(user.createdAt)}</b></span>);
+        disp.push(<span> created on <b>{formatDate(user.createdAt, true)}</b></span>);
     }
     return disp;
 }