X-Git-Url: https://git.arvados.org/arvados-workbench2.git/blobdiff_plain/f83344568cb070f716527288abe88a4ec5b0c305..badcb86fb7d0e2ab87c7dcef230072db2e2ae95e:/src/common/formatters.ts diff --git a/src/common/formatters.ts b/src/common/formatters.ts index 5383c66e..377e78e4 100644 --- a/src/common/formatters.ts +++ b/src/common/formatters.ts @@ -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) => {