X-Git-Url: https://git.arvados.org/arvados-workbench2.git/blobdiff_plain/fbd2012fa56f6de44dfc4008d70e5a21cfcaf459..b9da9116feeb510f5dae9da6e4f912ecf4aee298:/src/common/formatters.ts diff --git a/src/common/formatters.ts b/src/common/formatters.ts index 1d9a5201..38ef0223 100644 --- a/src/common/formatters.ts +++ b/src/common/formatters.ts @@ -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"