X-Git-Url: https://git.arvados.org/arvados-workbench2.git/blobdiff_plain/4bbaf2a0cede89ea50d63d210c6631adc1970620..dd01c37f3cc8b741e4202c480271eb2ffa6a3021:/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"